authentication

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CodeTypeMissingBearerToken indicates that the bearer token was not provided
	CodeTypeMissingBearerToken errors.CodeType = "MISSING_BEARER_TOKEN"
	// CodeTypeErrorOnRenewingCerts indicates that the application couldnt renew the JWKS certificates
	CodeTypeErrorOnRenewingCerts errors.CodeType = "COULD_NOT_RENEW_CERTS"
	// CodeTypeErrorOnParsingJWTToken indicates that the application couldn't parse the JWT token
	CodeTypeErrorOnParsingJWTToken errors.CodeType = "COULD_NOT_HANDLE_TOKEN"
)
View Source
const ContextKeyAccountID string = "account_id"

ContextKeyAccountID is the key used to retrieve and save accountId into the context

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAuthenticator

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

AccountAuthenticator structure responsible for handling request authentication

func MustNewAccountAuthenticator

func MustNewAccountAuthenticator(logger infra.Logger, jwks infra.JWKSClient) AccountAuthenticator

NewAccountAuthenticator creates a new instance of the AccountAuthenticator structure. It panics if any error is found.

func NewAccountAuthenticator

func NewAccountAuthenticator(logger infra.Logger, jwks infra.JWKSClient) (AccountAuthenticator, error)

NewAccountAuthenticator creates a new instance of the AccountAuthenticator structure

func (AccountAuthenticator) Authenticate

func (ua AccountAuthenticator) Authenticate(ctx *routing.Context) error

Authenticate is responsible for verify if the request is authenticated

It tries to authenticate the token with the certifications on memory, if it fails, the certifications are renewed and the authentication is run again.

Jump to

Keyboard shortcuts

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