token

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSigningKeyInvalid            = errors.New("invalid signing key")
	ErrTokenSigningMethodNotSupport = errors.New("not supported signing method")
	ErrTokenExpired                 = errors.New("expired token")
	ErrTokenNotYetValid             = errors.New("not yet valid token")
	ErrTokenInvalidIssuer           = errors.New("token issuer is invalid")
	ErrTokenInvalidFormat           = errors.New("token format is invalid")
)

Functions

This section is empty.

Types

type Claims

type Claims interface {
	Valid() error
}

type Engine

type Engine interface {
	Type() string
	Generate(ctx context.Context, inner Claims) (string, error)
	Validate(ctx context.Context, token string, claims Claims) error
}

type JWTEngine

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

func NewJWTEngine

func NewJWTEngine() *JWTEngine

func (*JWTEngine) Generate

func (engine *JWTEngine) Generate(ctx context.Context, claims Claims) (string, error)

func (*JWTEngine) Type

func (*JWTEngine) Type() string

func (*JWTEngine) Validate

func (engine *JWTEngine) Validate(ctx context.Context, token string, claims Claims) error

func (*JWTEngine) WithHMAC

func (engine *JWTEngine) WithHMAC(secret string) error

func (*JWTEngine) WithRSA

func (engine *JWTEngine) WithRSA(priv, pub string) error

Jump to

Keyboard shortcuts

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