Documentation
¶
Index ¶
- func APIKeyOnly(app apikey.Manager, modes ...ErrorMode) fiber.Handler
- func Any(authenticators ...Authenticator) fiber.Handler
- func AnyWithMode(mode ErrorMode, authenticators ...Authenticator) fiber.Handler
- func SetPrincipalLocals(c fiber.Ctx, p *Principal)
- func SetPrincipalsLocals(c fiber.Ctx, principals []*Principal)
- func UserAndAPIKey(user token.Manager, app apikey.Manager, modes ...ErrorMode) fiber.Handler
- func UserOnly(user token.Manager, modes ...ErrorMode) fiber.Handler
- func WithPrincipal(ctx context.Context, p *Principal) context.Context
- func WithPrincipals(ctx context.Context, principals []*Principal) context.Context
- type Authenticator
- type AuthenticatorFunc
- type ErrorMode
- type Principal
- type PrincipalType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any ¶
func Any(authenticators ...Authenticator) fiber.Handler
func AnyWithMode ¶
func AnyWithMode(mode ErrorMode, authenticators ...Authenticator) fiber.Handler
func SetPrincipalLocals ¶
func SetPrincipalsLocals ¶
func UserAndAPIKey ¶
Types ¶
type Authenticator ¶
type Authenticator interface {
// Authenticate returns:
// - principal when auth succeeds
// - matched=true when credential source was present and processed
// - err when processing/validation failed
Authenticate(c fiber.Ctx) (*Principal, bool, error)
}
func APIKeyAuthenticator ¶
func APIKeyAuthenticator(app apikey.Manager) Authenticator
func UserTokenAuthenticator ¶
func UserTokenAuthenticator(user token.Manager) Authenticator
type AuthenticatorFunc ¶
func (AuthenticatorFunc) Authenticate ¶
type Principal ¶
type PrincipalType ¶
type PrincipalType string
const ( PrincipalUser PrincipalType = "user" PrincipalApp PrincipalType = "app" )
Click to show internal directories.
Click to hide internal directories.