jwt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 4 Imported by: 0

README

JWT Management

Installation

go get -u github.com/Metadiv-Technology-Limited/jwt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

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

Claims is a simple claims implementation that can be used to store and retrieve claims data.

func NewClaims

func NewClaims() *Claims

NewClaims creates a new empty Claims instance.

func ParseTokenByPublicPEM

func ParseTokenByPublicPEM(token, pubPEM string) *Claims

Parse a token using the public pem and return the claims.

func ParseTokenBySecret

func ParseTokenBySecret(token, secret string) *Claims

Parse a token using the secret and return the claims.

func ParseTokenUnverified

func ParseTokenUnverified(token string) *Claims

Parse a token without secret or pem, then return the claims.

func (*Claims) Get

func (c *Claims) Get(key string) interface{}

Get gets a claim value.

func (*Claims) Set

func (c *Claims) Set(key string, value interface{})

Set sets a claim value.

func (*Claims) ToTokenByPrivatePEM

func (c *Claims) ToTokenByPrivatePEM(privPEM string, expiredAfter time.Duration) (string, error)

Generate a token from the claims using the private pem.

func (*Claims) ToTokenBySecret

func (c *Claims) ToTokenBySecret(secret string, expiredAfter time.Duration) (string, error)

Generate a token from the claims using the secret.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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