auth

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultTokenType = "identityToken"
)

Variables

View Source
var (
	ErrIncorrectCredentials = errors.New("incorrect credentials")
	ErrChallenged           = errors.New("user password needs to be reset")
	ErrTooManyRequests      = errors.New("too many requests to Enlight SSO")
	ErrInactivated          = errors.New("user has been inactivated")
	ErrUnknownTokenType     = errors.New("provided token type not present in response")
)
View Source
var (
	ErrInvalidToken = errors.New("invalid token")
)

Functions

This section is empty.

Types

type CachedTokenProvider added in v0.8.0

type CachedTokenProvider struct {
	TokenProvider
	// contains filtered or unexported fields
}

func NewCachedTokenProvider added in v0.8.0

func NewCachedTokenProvider(provider TokenProvider) *CachedTokenProvider

func (*CachedTokenProvider) GetRawToken added in v0.8.0

func (p *CachedTokenProvider) GetRawToken(ctx context.Context) (RawToken, error)

func (*CachedTokenProvider) WithClock added in v0.12.0

func (p *CachedTokenProvider) WithClock(clock func() time.Time) *CachedTokenProvider

func (*CachedTokenProvider) WithGracePeriod added in v0.8.0

func (p *CachedTokenProvider) WithGracePeriod(duration time.Duration) *CachedTokenProvider

type CredentialsClient added in v0.8.0

type CredentialsClient interface {
	Do(*http.Request) (*http.Response, error)
}

type CredentialsTokenProvider added in v0.8.0

type CredentialsTokenProvider struct {
	Username string
	Password string
	Endpoint string

	Client    CredentialsClient
	TokenType string
	Retry     retry.BackoffProvider
}

func (*CredentialsTokenProvider) GetRawToken added in v0.8.0

func (provider *CredentialsTokenProvider) GetRawToken(ctx context.Context) (RawToken, error)

type RawToken

type RawToken string

func (RawToken) GetRawToken

func (token RawToken) GetRawToken(_ context.Context) (RawToken, error)

func (RawToken) ParseExpires added in v0.8.0

func (token RawToken) ParseExpires() (time.Time, error)

ParseExpires attempts to extract the `exp` claim from the JWT. This function does not validate that the token is signed and should only be used if the correctness of this value is not used for security.

func (RawToken) String

func (token RawToken) String() string

type SecretCredentials added in v0.8.0

type SecretCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Endpoint string `json:"signInUrl"`
}

type SecretCredentialsTokenProvider added in v0.8.0

type SecretCredentialsTokenProvider struct {
	SecretID      string
	SecretsClient SecretsClient

	Client    CredentialsClient
	TokenType string
	Retry     retry.BackoffProvider
	// contains filtered or unexported fields
}

func (*SecretCredentialsTokenProvider) GetRawToken added in v0.8.0

func (provider *SecretCredentialsTokenProvider) GetRawToken(ctx context.Context) (_ RawToken, err error)

type SecretsClient added in v0.8.0

type SecretsClient interface {
	GetSecretByID(context.Context, string) ([]byte, error)
}

type SecretsManagerTokenProvider deprecated

type SecretsManagerTokenProvider struct {
	Config secretsmanagerauth.Config
	// contains filtered or unexported fields
}

Deprecated: Use CredentialsTokenProvider instead

func (*SecretsManagerTokenProvider) GetRawToken

func (provider *SecretsManagerTokenProvider) GetRawToken(ctx context.Context) (RawToken, error)

type SecretsManagerV1Client added in v0.8.0

type SecretsManagerV1Client struct {
	*sm_v1.SecretsManager
}

func (SecretsManagerV1Client) GetSecretByID added in v0.8.0

func (c SecretsManagerV1Client) GetSecretByID(ctx context.Context, secretID string) ([]byte, error)

type SecretsManagerV2Client added in v0.8.0

type SecretsManagerV2Client struct {
	*sm_v2.Client
}

func (SecretsManagerV2Client) GetSecretByID added in v0.8.0

func (c SecretsManagerV2Client) GetSecretByID(ctx context.Context, secretID string) ([]byte, error)

type SignInRequest added in v0.8.0

type SignInRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type SignInResponse added in v0.8.0

type SignInResponse struct {
	Tokens    map[string]RawToken `json:"tokens"`
	Challenge *struct {
		ID   string `json:"id"`
		Type string `json:"type"`
	} `json:"challenge"`
}

type TokenProvider

type TokenProvider interface {
	GetRawToken(ctx context.Context) (RawToken, error)
}

Jump to

Keyboard shortcuts

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