jwt

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitiateModule

func InitiateModule(scope string) fx.Option

InitiateModule initializes the JWT middleware with the provided scope. CONFIG --> scope.token_lookup, scope.signing_key, scope.signing_method, scope.exp_in_hours

Types

type Config

type Config struct {
	TokenLookup   string
	SigningKey    string
	SigningMethod string
	ExpInHours    int
}

type Module added in v0.1.8

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

func (*Module) GenerateToken added in v0.1.8

func (m *Module) GenerateToken(additionalClaims jwt.MapClaims) (*string, error)

GenerateToken generates a JWT token with the provided additional claims. It takes additionalClaims as input, which is a map of custom claims to be added to the token. SigningKey, SigningMethod, and ExpInHours are taken from the config keys scope.signing_key, scope.signing_method, and scope.exp_in_hours respectively. The function returns a pointer to the generated token string and an error, if any.

func (*Module) Middleware added in v0.1.8

func (m *Module) Middleware() echo.MiddlewareFunc

Middleware returns the echo.MiddlewareFunc for JWT authentication.

func (*Module) PrintDebugLogs added in v0.1.8

func (m *Module) PrintDebugLogs()

type Params

type Params struct {
	fx.In

	Logger    *zap.Logger
	Lifecycle fx.Lifecycle
}

Jump to

Keyboard shortcuts

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