jwtclaims

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KnownInsecureJWTSecret is the placeholder shipped in config.go's struct
	// tag; it must never sign real tokens. Keep in sync with the `default:` tag
	// on Config.JWTSecret.
	KnownInsecureJWTSecret = "default-jwt-secret-change-me" //nolint:gosec // public placeholder config default, intentionally rejected for production signing
	// MinJWTSecretLength matches the 32-byte floor enforced for ENCRYPTION_KEY.
	MinJWTSecretLength = 32
)

Variables

This section is empty.

Functions

func CheckOrGenerateJwtSecret

func CheckOrGenerateJwtSecret(jwtSecret string, requireExplicit bool) []byte

CheckOrGenerateJwtSecret returns the HMAC signing key for JWTs.

When requireExplicit is true (production manager), a real secret is mandatory: an empty, default, or too-short JWT_SECRET panics at startup — mirroring the ENCRYPTION_KEY guard in libarcane/crypto. Otherwise (development / agent mode) a random per-boot key is generated when none (or only the public default) is configured, so the public default never becomes a live signing key.

func EvalMatch

func EvalMatch(v any, want []string) bool

EvalMatch checks if a claim matches any of the desired values

func GetBoolClaim

func GetBoolClaim(m map[string]any, key string) bool

GetBoolClaim extracts a boolean claim from a map

func GetByPath

func GetByPath(m map[string]any, path string) (any, bool)

GetByPath extracts a value from a nested map using a dot-separated path

func GetStringClaim

func GetStringClaim(m map[string]any, key string) string

GetStringClaim extracts a string claim from a map

func GetStringSliceClaim

func GetStringSliceClaim(m map[string]any, key string) []string

GetStringSliceClaim extracts a string slice claim from a map

func ParseJWTClaims

func ParseJWTClaims(idToken string) map[string]any

ParseJWTClaims decodes and unmarshals the payload part of a JWT

Types

This section is empty.

Jump to

Keyboard shortcuts

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