jwtauth

package
v0.0.0-...-8e4c2be Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenPrefixBearer = "Bearer "

	AppointedSeatHeader = "header:Authorization"
)

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid token")
)

Functions

This section is empty.

Types

type JWTAuth

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

func New

func New(opts ...Option) *JWTAuth

func (*JWTAuth) GenerateToken

func (j *JWTAuth) GenerateToken(userID string) (string, error)

func (*JWTAuth) ParseUserID

func (j *JWTAuth) ParseUserID(jwtString string) (string, error)

type Option

type Option func(*profile)

func SetAppointedSeat

func SetAppointedSeat(seat string) Option

SetAppointedSeat the seat parameter is a string in the form of "<source>:<name>" that is used to extract token from the request. Possible values: - "header:<name>" - "query:<name>" - "cookie:<name>"

func SetExpired

func SetExpired(expired int64) Option

func SetKeyFunc

func SetKeyFunc(keyFunc kinet.Keyfunc) Option

func SetSigningKey

func SetSigningKey(key interface{}) Option

func SetSigningMethod

func SetSigningMethod(method kinet.SigningMethod) Option

func SetTokenPrefix

func SetTokenPrefix(prefix string) Option

Jump to

Keyboard shortcuts

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