jwt

package
v16.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Realm         string
	Secret        string
	SkipLocalhost bool
}

The Config type holds information that is required to create a new JWT provider

type JWT

type JWT interface {
	AddValidator(iss string, issuer Validator) error

	ClearValidators()

	Validators() []string

	// Middleware returns an echo middleware
	AccessMiddleware() echo.MiddlewareFunc
	RefreshMiddleware() echo.MiddlewareFunc

	// LoginHandler is an echo route handler for retrieving a JWT
	LoginHandler(c echo.Context) error

	// RefreshHandle is an echo route handler for refreshing a JWT
	RefreshHandler(c echo.Context) error
}

JWT provides access to a JWT provider

func New

func New(config Config) (JWT, error)

New returns a new JWT provider

type Validator

type Validator interface {
	String() string

	// Validate returns true if it identified itself as validator for
	// that request. False if it doesn't handle this request. The string
	// is the username. An error is only returned if it identified itself
	// as validator but there was an error during validation.
	Validate(c echo.Context) (bool, string, error)
	Cancel()
}

func NewAuth0Validator

func NewAuth0Validator(domain, audience, clientID string, users []string) (Validator, error)

func NewLocalValidator

func NewLocalValidator(username, password string) (Validator, error)

Directories

Path Synopsis
Package jwks implements a JSON Web Key Set Based on https://github.com/MicahParks/keyfunc without implementing the KeyFunc
Package jwks implements a JSON Web Key Set Based on https://github.com/MicahParks/keyfunc without implementing the KeyFunc

Jump to

Keyboard shortcuts

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