auth

package
v0.0.0-...-db1a339 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TicketTTL = time.Second * 5

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

This section is empty.

Types

type Claims

type Claims struct {
	EmailVerified bool `json:"email_verified,omitempty"`
}

type Config

type Config struct {
	Enabled bool
	OIDC    *OIDCConfig
	Ticket  *TicketConfig
}

func (Config) Validate

func (c Config) Validate() error

Validate implements config.ConfigurationValidator.

type InMemKey

type InMemKey struct {
	// contains filtered or unexported fields
}

type InMemStore

type InMemStore struct {
	// contains filtered or unexported fields
}

func NewInMemStore

func NewInMemStore() *InMemStore

func (*InMemStore) Close

func (s *InMemStore) Close() error

func (*InMemStore) GetDel

func (s *InMemStore) GetDel(ctx context.Context, key string) error

func (*InMemStore) SetEx

func (s *InMemStore) SetEx(ctx context.Context, key string, ttl time.Duration) error

type NoopTokenVerifier

type NoopTokenVerifier struct{}

func (*NoopTokenVerifier) Verify

func (t *NoopTokenVerifier) Verify(ctx context.Context, token string) (bool, error)

type OIDCConfig

type OIDCConfig struct {
	ProviderURL  string
	ClientID     string
	ClientSecret string
}

type OIDCTokenVerifier

type OIDCTokenVerifier struct {
	// contains filtered or unexported fields
}

func NewOIDCTokenVerifier

func NewOIDCTokenVerifier(ctx context.Context, cfg *OIDCConfig) (*OIDCTokenVerifier, error)

func (*OIDCTokenVerifier) Verify

func (t *OIDCTokenVerifier) Verify(ctx context.Context, token string) (bool, error)

type RedisConfig

type RedisConfig struct {
	Address string
	Prefix  string
}

type RedisStore

type RedisStore struct {
	// contains filtered or unexported fields
}

RedisStore is an implementation of TicketStore based on Redis.

func NewRedisStore

func NewRedisStore(ctx context.Context, tp trace.TracerProvider, cfg *RedisConfig) (*RedisStore, error)

func (*RedisStore) Close

func (s *RedisStore) Close() error

func (*RedisStore) GetDel

func (s *RedisStore) GetDel(ctx context.Context, key string) error

func (*RedisStore) SetEx

func (s *RedisStore) SetEx(ctx context.Context, key string, ttl time.Duration) error

type TicketConfig

type TicketConfig struct {
	Redis *RedisConfig
}

type TicketProvider

type TicketProvider struct {
	// contains filtered or unexported fields
}

TicketProvider issues WebSocket authentication tickets.

func NewTicketProvider

func NewTicketProvider(ctx context.Context, store TicketStore, rander io.Reader) *TicketProvider

NewTicketProvider creates a new TicketProvider. The provider is no-op when the store is nil.

func (*TicketProvider) Check

func (t *TicketProvider) Check(ctx context.Context, ticket string) error

Check that a ticket is known to the provider, not including tickets that exceeded the time-to-live attribute.

func (*TicketProvider) Close

func (t *TicketProvider) Close() error

Close closes the provider, releasing resources associated to the store.

func (*TicketProvider) Request

func (t *TicketProvider) Request(ctx context.Context) (string, error)

Request a new ticket.

type TicketStore

type TicketStore interface {
	// SetEx persists a key with a timeout.
	SetEx(ctx context.Context, key string, ttl time.Duration) error
	// GetDel checks whether a key exists in the store. It returns
	// ErrKeyNotFound if the key was not found or expired.
	GetDel(ctx context.Context, key string) error
	// Close the client.
	Close() error
}

TicketStore persists expirable tickets.

type TokenVerifier

type TokenVerifier interface {
	Verify(ctx context.Context, token string) (bool, error)
}

Directories

Path Synopsis
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL