Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements OAuth2 client credentials authentication. Tokens are opaque strings stored in the oauth_tokens table.
func NewDriver ¶
NewDriver creates an OAuth2 client credentials auth driver. Config is read from environment:
- OAUTH_CLIENT_ID: expected client ID (required)
- OAUTH_CLIENT_SECRET: expected client secret (required)
- OAUTH_TOKEN_EXPIRY: token lifetime in seconds (default: 3600)
func (*Driver) Authenticate ¶
Authenticate extracts the Bearer token from the request, validates it against the oauth_tokens table, and returns AuthInfo on success.
func (*Driver) TokenEndpoint ¶
TokenEndpoint is a handler for POST /oauth2/token that implements the OAuth2 client credentials grant. Wire it into your routes:
r.Post("/oauth2/token", oauth.TokenEndpoint)
Click to show internal directories.
Click to hide internal directories.