Documentation
¶
Overview ¶
Package session maintains a Redis-backed revocation list for JWT sessions, keyed by the token's jti claim.
Index ¶
- Constants
- Variables
- type Store
- func (s *Store) ConsumeResetSession(ctx context.Context, token string) (uint, error)
- func (s *Store) CreateResetSession(ctx context.Context, userID uint) (string, error)
- func (s *Store) IsRevoked(ctx context.Context, jti string) bool
- func (s *Store) MarkRevoked(ctx context.Context, jti string, expiresAt time.Time)
Constants ¶
const ResetSessionTTL = 15 * time.Minute
ResetSessionTTL bounds how long a forced-password-change reset token is valid.
Variables ¶
var ErrResetSession = errors.New("reset session is invalid or has expired")
ErrResetSession is returned when a reset-session token is missing, expired, or already used.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ConsumeResetSession ¶ added in v1.1.0
ConsumeResetSession atomically validates and deletes a reset token, returning the user it belongs to. Single-use: a second call with the same token fails.
func (*Store) CreateResetSession ¶ added in v1.1.0
CreateResetSession stores a short-lived, single-use token authorizing exactly one action — setting a new password for userID — and returns it. Used by the forced-password-change flow so a user with an admin-set/reset password never receives a full session until they've chosen their own password.