Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractExp ¶
ExtractExp returns the exp (expiration) claim of a JWT as a unix timestamp, without full signature validation (the caller has already validated the token via ValidateToken). Returns 0 if the token is malformed or the claim is missing — callers should treat 0 as "unknown" and fall back to a conservative default.
Used by Epic 56 to size the soft-unlock durable row's TTL to the JWT's actual remaining lifetime, rather than a hardcoded ceiling.
func ExtractJTI ¶
ExtractJTI extracts the jti (JWT ID) claim from a JWT token without full validation (validation is already done by ValidateToken). Returns empty string if extraction fails.
func ExtractToken ¶
func ExtractToken(c *gin.Context, config ...TokenExtractorConfig) string
ExtractToken extracts the authentication token from the request
Types ¶
type TokenExtractorConfig ¶
type TokenExtractorConfig struct {
// HeaderName is the name of the header containing the authentication token
HeaderName string
// TokenType is the type of token (e.g., "Bearer")
TokenType string
// QueryParamName is the name of the query parameter containing the authentication token
QueryParamName string
// CookieName is the name of the cookie containing the authentication token
CookieName string
}
TokenExtractorConfig defines configuration for token extraction
func DefaultTokenExtractorConfig ¶
func DefaultTokenExtractorConfig() TokenExtractorConfig
DefaultTokenExtractorConfig returns the default token extraction configuration