jwtext

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, jwt *JWT) context.Context

Types

type Configs

type Configs struct {
	JwtPublicKey     string        `env:"JWT_PUBLIC_KEY,required,file"`
	JwtPrivateKey    string        `env:"JWT_PRIVATE_KEY,file"`
	JwtTokenDuration time.Duration `env:"JWT_TOKEN_DURATION" envDefault:"24h"`
}

type JWT

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

func FromContext

func FromContext(ctx context.Context) *JWT

func Setup

func Setup(configs Configs) (*JWT, error)

func (JWT) Authorize

func (a JWT) Authorize(auth authenticate.Authenticate, scopes ...string) (*authorize.Claims, error)

func (JWT) Sign

Jump to

Keyboard shortcuts

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