jwtutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateAudience

func ValidateAudience(tokenAud []string, requiredAudiences []string) error

ValidateAudience checks if the token's audience matches any of the required audiences. If requiredAudiences is empty, audience validation is skipped (no restriction).

Types

type AccessTokenClaims

type AccessTokenClaims struct {
	UserID    string   `json:"sub"`
	Email     string   `json:"email"`
	SessionID string   `json:"sid"`
	IssuedAt  int64    `json:"iat"`
	ExpiresAt int64    `json:"exp"`
	Audience  []string `json:"aud"`
	Issuer    string   `json:"iss"`
}

func ValidateAccessToken

func ValidateAccessToken(tokenString string) (*AccessTokenClaims, error)

ValidateAccessToken parses and validates an access token, returning its claims. It always uses the configured secret and validates the audience.

func (*AccessTokenClaims) Valid

func (a *AccessTokenClaims) Valid() error

Jump to

Keyboard shortcuts

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