jwt

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

JWT implementation.

Index

Constants

View Source
const (

	// misoconfig-prop: public key for verifying the JWT token
	PropJwtPublicKey = "jwt.key.public"

	// misoconfig-prop: private key for signing the JWT token
	PropJwtPrivateKey = "jwt.key.private"

	// misoconfig-prop: issuer of the token
	PropJwtIssue = "jwt.key.issuer"
)

misoconfig-section: JWT Configuration

Variables

View Source
var (
	ErrMissingPrivateKey  = errors.New("missing private key")
	ErrMissingPublicKey   = errors.New("missing public key")
	ErrExtractClaimFailed = errors.New("unable to extract claims from token")
)

Functions

func JwtEncode

func JwtEncode(claims jwt.MapClaims, exp time.Duration) (string, error)

JWT Encode using default configuration in loaded properties.

func JwtKeyEncode added in v0.1.23

func JwtKeyEncode(pk *rsa.PrivateKey, claims jwt.MapClaims, exp time.Duration, issuer string) (string, error)

JWT Encode using provided key, claims, exp and iss.

Types

type ParsedJwt

type ParsedJwt struct {
	Valid  bool
	Claims jwt.MapClaims
}

func JwtDecode

func JwtDecode(token string) (ParsedJwt, error)

JWT Decode using default configuration in loaded properties.

func JwtKeyDecode added in v0.1.23

func JwtKeyDecode(pk *rsa.PublicKey, token string, issuer string) (ParsedJwt, error)

JWT Decode using provided key and iss.

Jump to

Keyboard shortcuts

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