jwt

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextWithScopes

func NewContextWithScopes(ctx context.Context, scopes []*Scope) context.Context

func ScopeMatch

func ScopeMatch(subject, target *Scope) bool

func ScopesMatch

func ScopesMatch(subjects []*Scope, target *Scope) bool

Types

type ClaimsAuthoriser

type ClaimsAuthoriser struct {
	Predicate jwt.ClaimPredicate
}

ClaimsAuthoriser checks if the request satisfies a claim predicate.

func (*ClaimsAuthoriser) Wrap

func (a *ClaimsAuthoriser) Wrap(next http.Handler) http.Handler

Create middleware that checks if request satisfies the predicate

type Handler

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

Handler handles JWT authentication and sets the authenticated principal in the context.

func NewHandler

func NewHandler(validator jwt.TokenValidator, cookieName string, logger zerolog.Logger, opts ...jwtmiddleware.Option) *Handler

func (*Handler) Wrap

func (h *Handler) Wrap(next http.Handler) http.Handler

type ResourceAuthoriser

type ResourceAuthoriser struct {
	Service       string
	DefaultAction string
}

ResourceAuthoriser handles resource-level permissions (scopes).

func (*ResourceAuthoriser) RequireScope

func (a *ResourceAuthoriser) RequireScope(resource, action string) func(http.Handler) http.Handler

type Scope

type Scope struct {
	Service  string
	Resource string
	Action   string
}

func ScopesFromContext

func ScopesFromContext(ctx context.Context) ([]*Scope, bool)

func (*Scope) String

func (s *Scope) String() string

Jump to

Keyboard shortcuts

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