Documentation
¶
Overview ¶
Package ott provides one-time token authentication capabilities (reserved module).
Index ¶
Constants ¶
View Source
const DefaultPurpose verification.Purpose = "ott:token"
DefaultPurpose is the default verification purpose for one-time tokens.
View Source
const PluginID = "one_time_token"
PluginID is the unique identifier for this plugin module.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DefaultTTL time.Duration
Purpose verification.Purpose
}
Config defines the configuration for the one-time token plugin.
type GenerateOption ¶
type GenerateOption func(*GenerateOptions)
GenerateOption mutates GenerateOptions.
func WithCustomPurpose ¶
func WithCustomPurpose(p verification.Purpose) GenerateOption
WithCustomPurpose overrides the token purpose for a single generation.
func WithCustomTTL ¶
func WithCustomTTL(ttl time.Duration) GenerateOption
WithCustomTTL overrides the token TTL for a single generation.
type GenerateOptions ¶
type GenerateOptions struct {
TTL time.Duration
Purpose verification.Purpose
}
GenerateOptions contains per-token options.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements auth.PluginModule for One-Time Token authentication.
type OneTimeToken ¶
type OneTimeToken interface {
// Generate creates a secure, single-use token bound to subject.
Generate(ctx context.Context, subject string, opts ...GenerateOption) (string, error)
// Consume atomically consumes the token and returns the underlying verification token.
Consume(ctx context.Context, token string, opts ...GenerateOption) (*verification.Token, error)
// Revoke invalidates all active tokens for the given subject.
Revoke(ctx context.Context, subject string, opts ...GenerateOption) error
}
OneTimeToken defines the public capability exposed by this plugin.
Click to show internal directories.
Click to hide internal directories.