Documentation
¶
Overview ¶
Package jti implements the JTI (JWT/token ID) allowlist that backs token revocation and session-bound replay detection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DenyList ¶
type DenyList interface {
// Deny marks jti as unusable until ttl elapses.
Deny(ctx context.Context, jti string, ttl time.Duration) error
// Denied returns true when jti has been denied.
Denied(ctx context.Context, jti string) (bool, error)
}
DenyList records JTIs that may no longer be used: revoked JWT access tokens (RFC 7009) and already-seen client_assertion JTIs (replay defence).
type Store ¶
type Store interface {
// Issue registers jti as valid for sessionID with the given TTL.
Issue(ctx context.Context, jti, sessionID string, ttl time.Duration) error
// Rotate atomically replaces oldJTI with newJTI for sessionID. Return false (no error)
// when oldJTI is absent or belongs to a different session.
Rotate(ctx context.Context, oldJTI, newJTI, sessionID string, ttl time.Duration) (bool, error)
// Revoke removes jti from the allowlist.
Revoke(ctx context.Context, jti string) error
// Validate returns true when jti exists in the allowlist and belongs to sessionID.
Validate(ctx context.Context, jti, sessionID string) (bool, error)
}
Store manages the JTI allowlist.
Click to show internal directories.
Click to hide internal directories.