Documentation
¶
Overview ¶
Package device implements the OAuth 2.0 Device Authorization Grant plugin.
It handles POST /device_authorization (RFC 8628 §3.1), the GET/POST /device verification page (RFC 8628 §3.3), and the device_code grant type on the token endpoint (RFC 8628 §3.4).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Store storm.DeviceAuthStore
ClientStore storm.ClientStore
// Lifetime is the device code expiration duration (default: 15m).
Lifetime time.Duration
// Interval is the minimum polling interval in seconds (default: 5).
Interval time.Duration
// DeviceTemplate overrides the default device verification page template.
// The template receives a map with "UserCode", "ClientID", "Scopes", "Error", "CSRFToken" keys.
// If nil, the embedded default template is used.
DeviceTemplate *template.Template
// MaxUserCodeRetries limits how many times to retry user_code generation on collision.
// Prevents infinite loops if the store is full or has high collision probability.
// Default is 100.
MaxUserCodeRetries int
// CSRFKey is a 32-byte key for signing CSRF cookies on the verification page.
// If nil, CSRF protection is disabled (not recommended for production).
// Uses pkg/util/http CookieHandler for secure cookie handling.
CSRFKey []byte
}
Config holds the dependencies for the Device plugin.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the OAuth 2.0 Device Authorization Grant (RFC 8628).
func NewWithConfig ¶
NewWithConfig creates a new Device plugin with explicit config.
func (*Plugin) Category ¶
func (p *Plugin) Category() storm.PluginCategory
Category returns CategoryStandard — device is optional but enabled by default.
func (*Plugin) Contribute ¶
func (p *Plugin) Contribute(ctx context.Context, cfg *protocol.DiscoveryConfiguration)
Contribute returns the discovery fields for the device authorization endpoint.
Click to show internal directories.
Click to hide internal directories.