Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAzp ¶ added in v1.6.8
ExtractAzp parses a JWT without signature verification and returns the "azp" (authorized party) claim. Used to determine which client a token was issued to before performing ownership checks. Returns "" if the claim is absent or the token is malformed — callers should treat missing azp as "skip the check".
func ValidateAudience ¶
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
Click to show internal directories.
Click to hide internal directories.