auth

package
v0.0.0-...-38a15d6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func New

func New(cfg Config) (*Auth, error)

New creates a new Auth struct & configures it with the provided Config.

func (*Auth) Authenticate

func (a *Auth) Authenticate(ctx context.Context, bearerToken string) (Claims, error)

func (*Auth) Issuer

func (a *Auth) Issuer() string

Issuer returns the issuer of the token configured in the Auth struct.

type Claims

type Claims struct {
	jwt.RegisteredClaims
	RealmAccess RealmAccess `json:"realm_access"`
}

type Config

type Config struct {
	Log         *logger.Logger
	JWTValidate JWTValidate
	Issuer      string
}

type JWTValidate

type JWTValidate interface {
	PublicKey(discoveryURL string, skipCert bool) error
	ValidateJWT(token string, kid string) error
}

type RealmAccess

type RealmAccess struct {
	Roles []string `json:"roles"`
}

Jump to

Keyboard shortcuts

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