Documentation ¶
Index ¶
- Variables
- func Authenticate(opts ...AuthenticatorOpt) openapi3filter.AuthenticationFunc
- func Authenticate2(fn ...openapi3filter.AuthenticationFunc) openapi3filter.AuthenticationFunc
- type AuthClaims
- type Authenticator
- type AuthenticatorOpt
- type AuthenticatorOpts
- type NoopAuthenticator
- type OIDCAuthenticator
- type OidcConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnauthenticated = fiber.NewError(fiber.StatusUnauthorized, "unauthenticated") ErrMissingBearerToken = fiber.NewError(fiber.StatusUnauthorized, "missing bearer token") )
Functions ¶
func Authenticate ¶
func Authenticate(opts ...AuthenticatorOpt) openapi3filter.AuthenticationFunc
Authenticate returns a nil error and the AuthClaims info (if available) if the subject is authenticated or a
func Authenticate2 ¶
func Authenticate2(fn ...openapi3filter.AuthenticationFunc) openapi3filter.AuthenticationFunc
Authenticate2 ...
Types ¶
type AuthClaims ¶
AuthClaims contains claims that are included in OIDC standard claims. https://openid.net/specs/openid-connect-core-1_0.html#IDToken
type Authenticator ¶
type Authenticator interface { // Authenticate returns a nil error and the AuthClaims info (if available) if the subject is authenticated or a // non-nil error with an appropriate error cause otherwise. Authenticate(requestContext context.Context) (*AuthClaims, error) // Close Cleans up the authenticator. Close() }
Authenticator is an interface for authenticating a subject.
type AuthenticatorOpt ¶
type AuthenticatorOpt func(*AuthenticatorOpts)
AuthenticatorOpt is a function that sets the configuration for the authenticator.
func WithBasicAuthSchema ¶
func WithBasicAuthSchema(auth openapi3filter.AuthenticationFunc) AuthenticatorOpt
WithBasicSchema sets the basic authentication schema for the authenticator.
func WithOIDCSchema ¶
func WithOIDCSchema(auth openapi3filter.AuthenticationFunc) AuthenticatorOpt
WithOIDCSchema sets the OIDC authentication schema for the authenticator.
func WithSchema ¶
func WithSchema(schema string, auth openapi3filter.AuthenticationFunc) AuthenticatorOpt
WithSchema sets the authentication schema for the authenticator.
type AuthenticatorOpts ¶
type AuthenticatorOpts struct {
Schemas map[string]openapi3filter.AuthenticationFunc
}
AuthenticatorOpts is a function that sets the configuration for the authenticator.
func DefaultAuthenticatorOpts ¶
func DefaultAuthenticatorOpts() AuthenticatorOpts
DefaultAuthenticatorOpts returns the default authenticator options.
func (*AuthenticatorOpts) Configure ¶
func (c *AuthenticatorOpts) Configure(opts ...AuthenticatorOpt)
Configure sets the configuration for the authenticator.
type NoopAuthenticator ¶
type NoopAuthenticator struct{}
func (NoopAuthenticator) Authenticate ¶
func (n NoopAuthenticator) Authenticate(requestContext context.Context) (*AuthClaims, error)
func (NoopAuthenticator) Close ¶
func (n NoopAuthenticator) Close()
type OIDCAuthenticator ¶
type OIDCAuthenticator interface { GetConfiguration() (*OidcConfig, error) GetKeys() (*keyfunc.JWKS, error) }
OIDCAuthenticator is an interface for OIDC authentication.
type OidcConfig ¶
OidcConfig contains authorization server metadata. See https://datatracker.ietf.org/doc/html/rfc8414#section-2