Documentation
¶
Index ¶
- type Config
- type Plugin
- func (p *Plugin) AuthenticateHandler(next func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) ID() string
- func (p *Plugin) Init(authInst core.Authsome) error
- func (p *Plugin) RegisterServiceDecorators(_ *registry.ServiceRegistry) error
- func (p *Plugin) RequireAuthHandler(next func(forge.Context) error) func(forge.Context) error
- type PluginOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// TokenPrefix is the expected prefix for bearer tokens
TokenPrefix string `json:"tokenPrefix"`
// ValidateIssuer checks the token issuer
ValidateIssuer bool `json:"validateIssuer"`
// RequireScopes enforces scope validation
RequireScopes []string `json:"requireScopes"`
// CaseSensitive makes token comparison case-sensitive
CaseSensitive bool `json:"caseSensitive"`
}
Config holds the bearer plugin configuration
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default bearer plugin configuration
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements bearer token authentication middleware
func NewPlugin ¶
func NewPlugin(opts ...PluginOption) *Plugin
NewPlugin creates a new bearer token plugin with optional configuration
func (*Plugin) AuthenticateHandler ¶
AuthenticateHandler returns a handler function that can be used as middleware
func (*Plugin) RegisterServiceDecorators ¶
func (p *Plugin) RegisterServiceDecorators(_ *registry.ServiceRegistry) error
RegisterServiceDecorators registers service decorators (no-op for bearer)
type PluginOption ¶
type PluginOption func(*Plugin)
PluginOption is a functional option for configuring the bearer plugin
func WithDefaultConfig ¶
func WithDefaultConfig(cfg Config) PluginOption
WithDefaultConfig sets the default configuration for the plugin
func WithRequireScopes ¶
func WithRequireScopes(scopes []string) PluginOption
WithRequireScopes sets the required scopes
func WithTokenPrefix ¶
func WithTokenPrefix(prefix string) PluginOption
WithTokenPrefix sets the token prefix
func WithValidateIssuer ¶
func WithValidateIssuer(validate bool) PluginOption
WithValidateIssuer sets whether to validate the issuer