Documentation
¶
Index ¶
- type Client
- type Configuration
- type ErrorResponse
- type OauthResponse
- type Scopes
- type Service
- type ServiceProvider
- func (p *ServiceProvider) Boot(app interface{}) error
- func (p *ServiceProvider) Configure(config map[string]interface{}) error
- func (p *ServiceProvider) Name() string
- func (p *ServiceProvider) Priority() int
- func (p *ServiceProvider) Register(app interface{}) error
- func (p *ServiceProvider) Service() *api.Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration = api.Configuration
type ErrorResponse ¶
type ErrorResponse = api.ErrorResponse
type OauthResponse ¶
type OauthResponse = api.OauthResponse
type Service ¶
func NewWithConfig ¶
func NewWithConfig(a *adele.Adele, config Configuration) (Service, error)
type ServiceProvider ¶
type ServiceProvider struct {
// contains filtered or unexported fields
}
ServiceProvider is the compiled Adele framework provider for OAuth2. It registers token exchange routes and wires up the OAuth2 service.
Example:
// Registered automatically via init(); access after boot:
p := app.GetProvider("oauth").(*oauth.ServiceProvider)
func (*ServiceProvider) Boot ¶
func (p *ServiceProvider) Boot(app interface{}) error
Boot is a no-op; all initialization is done in Register.
func (*ServiceProvider) Configure ¶
func (p *ServiceProvider) Configure(config map[string]interface{}) error
Configure maps a config map to the Configuration struct fields and stores it for use during Register.
func (*ServiceProvider) Name ¶
func (p *ServiceProvider) Name() string
Name returns the unique identifier for this provider.
func (*ServiceProvider) Priority ¶
func (p *ServiceProvider) Priority() int
Priority returns 51, placing this provider in the security tier per Adele conventions.
func (*ServiceProvider) Register ¶
func (p *ServiceProvider) Register(app interface{}) error
Register initializes the OAuth2 service and registers token routes on the Adele app.
func (*ServiceProvider) Service ¶
func (p *ServiceProvider) Service() *api.Service
Service returns the underlying *api.Service so consumers can mount AuthenticationTokenMiddleware on their own route groups. Returns nil if the provider has not been registered yet (call after provider.LoadProviders).
Typical use:
svc := oauthProvider.Service() r.Use(svc.AuthenticationTokenMiddleware())
This is the documented escape hatch when the consumer's router doesn't route through the provider's auto-mounted /oauth/* routes (e.g., chi-based apps that mount oauth_subrouter separately from /v1/*).