jwtmarshal

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Jwt Marshal

Golang JWT is a nice library, but it is not that useful when You have to work with structs instead of maps. Implementing Claims only for these purposes is kind of overkill, and MapClaims already brings a convenient way of validating exp, alg, iat, and such fields.

So, JwtMarshal just wraps a bunch of libraries so any object can be easily mapped to the token without problems.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTContext

type JWTContext struct {
	PrivKey       []byte
	PubKey        []byte
	SigningMethod jwt.SigningMethod
	ExpireAfter   time.Duration
}

JWTContext brings important parameters for JWT generation and validation together

func (JWTContext) Decode

func (c JWTContext) Decode(tokenString string, claims *any) error

func (JWTContext) NewToken

func (c JWTContext) NewToken(claims any) (string, error)

func (JWTContext) ReadKeyFiles added in v1.0.2

func (c JWTContext) ReadKeyFiles(priv string, pub string) error

ReadKeyFiles reads the given key files and updates the context values.

Jump to

Keyboard shortcuts

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