jwt

package
v0.0.0-...-9cb16bd Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	jwtPKG.Claims
	CustomClaims map[string]interface{} `json:"customClaims"`
}

type JWTResponse

type JWTResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
}

type JwtContext

type JwtContext interface {
	CreatePair(claims map[string]interface{}) (*JWTResponse, *errorhandler.Response)
	ParseJWT(auth string) (map[string]interface{}, *errorhandler.Response)
}

func NewJWT

func NewJWT(opts ...Option) (JwtContext, error)

NewJwtContext is the constructor for the jwt context

type JwtOptions

type JwtOptions struct {
	PublicKeyPath  string
	PrivateKeyPath string
	Kid            string
	Issuer         string
	Subject        string
}

JwtOptions defines the jwt configuration

type Option

type Option func(*JwtOptions)

Option is the func interface to assign options

func WithJWTIssuer

func WithJWTIssuer(issuer string) Option

WithJWTIssuer aims to set the issuer

func WithJWTKeyID

func WithJWTKeyID(kid string) Option

WithJWTKeyID aims to set the key id

func WithJWTPrivateKeyPath

func WithJWTPrivateKeyPath(path string) Option

WithJWTPrivateKeyPath aims to set the private key path

func WithJWTPublicKeyPath

func WithJWTPublicKeyPath(path string) Option

WithJWTPublicKeyPath aims to set the public key path

func WithJWTSubject

func WithJWTSubject(subject string) Option

WithJWTSubject aims to set the subject

Directories

Path Synopsis
Package mockjwt is a generated GoMock package.
Package mockjwt is a generated GoMock package.

Jump to

Keyboard shortcuts

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