jwt

package
v0.30.112 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrScopeNameRequired     = errors.New("scope name is required")
	ErrInvalidAudOption      = errors.New("invalid audience option")
	ErrInvalidJwksOption     = errors.New("invalid jwks option")
	ErrInvalidJwksUrl        = errors.New("invalid jwks.uri option")
	ErrJwksUrlOrKeysRequired = errors.New("option jwks.uri or jwks.keys is required")
	ErrMissingToken          = errors.New("missing security token")
	ErrEmptyToken            = errors.New("empty security token")
	ErrInvalidToken          = errors.New("invalid security token")
	ErrInvalidClaims         = errors.New("invalid security claims")
)

Functions

func Feature

func Feature(config ...func(*Installer)) setup.Feature

Types

type Installer

type Installer struct{}

Installer enables jwt authentication.

func (*Installer) DependsOn added in v0.30.40

func (i *Installer) DependsOn() []setup.Feature

func (*Installer) Install

func (i *Installer) Install(b *setup.Builder) error

type KeySet

type KeySet interface {
	At(jwksURI string) *promise.Promise[jwt.Keyfunc]
	From(jwksJSON json.RawMessage) (jwt.Keyfunc, error)
}

KeySet provides JWKS (JSON Web Key Sets) to verify JWT signatures.

type LoginModule

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

LoginModule authenticates a subject from a JWT (JSON Web Token).

func (*LoginModule) Constructor

func (l *LoginModule) Constructor(
	_ *struct {
		creates.It `key:"login.jwt"`
	}, jwks KeySet,
)

func (*LoginModule) Init

func (l *LoginModule) Init(opts map[string]any) error

func (*LoginModule) Login

func (l *LoginModule) Login(
	subject security.Subject,
	handler miruken.Handler,
) error

func (*LoginModule) Logout

func (l *LoginModule) Logout(
	subject security.Subject,
	handler miruken.Handler,
) error

type Scope

type Scope string

Scope is a grouping of claims which effectively represents a permission that is set on a token. e.g. orders:read

func (*Scope) InitWithTag added in v0.30.6

func (s *Scope) InitWithTag(tag reflect.StructTag) error

func (Scope) Name added in v0.30.6

func (s Scope) Name() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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