jwtauth

package
v0.0.0-...-ea208d4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized     = errors.New("jwtauth: token is unauthorized")
	ErrExpired          = errors.New("jwtauth: token is expired")
	ErrNBFInvalid       = errors.New("jwtauth: token nbf validation failed")
	ErrIATInvalid       = errors.New("jwtauth: token iat validation failed")
	ErrNoTokenFound     = errors.New("jwtauth: no token found")
	ErrAlgoInvalid      = errors.New("jwtauth: algorithm mismatch")
	ErrInvalidSignature = errors.New("jwtauth: invalid signature")
)

Functions

This section is empty.

Types

type JWTAuth

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

JWTAuth is a container for jwt authenticator manager

func NewJwtAuth

func NewJwtAuth(alg jwt.SigningMethod, signKey *rsa.PrivateKey, verifyKey *rsa.PublicKey) *JWTAuth

NewJwtAuth creates a JWTAuth authenticator instance

func (*JWTAuth) Encode

func (ja *JWTAuth) Encode(claims jwt.Claims) (string, error)

Encode generate the signed jwt

func (*JWTAuth) Verify

func (ja *JWTAuth) Verify(tokenString string) (*jwt.Token, error)

Verify a JWT string and returns a token object

Jump to

Keyboard shortcuts

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