Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth interface {
OAuth2
IsOAuth2Enabled() bool
GetOAuth2CORS() *config.CORSConfig
}
Auth defines the authentication oauth interface
type AuthorizationResponse ¶
AuthorizationResponse represents the response from the authorization endpoint
type ClientRegistrationResponse ¶
type ClientRegistrationResponse struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret,omitempty"`
RedirectURIs []string `json:"redirect_uris"`
GrantTypes []string `json:"grant_types"`
ResponseTypes []string `json:"response_types"`
TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"`
Scope string `json:"scope"`
}
ClientRegistrationResponse represents the response from the client registration endpoint
type OAuth2 ¶
type OAuth2 interface {
// ServerMetadata returns the server metadata
ServerMetadata(r *http.Request) map[string]interface{}
// Authorize handles the authorization request
Authorize(ctx context.Context, r *http.Request) (*AuthorizationResponse, error)
// Token handles the token request
Token(ctx context.Context, r *http.Request) (*TokenResponse, error)
// Register handles client registration
Register(ctx context.Context, r *http.Request) (*ClientRegistrationResponse, error)
// Revoke handles token revocation
Revoke(ctx context.Context, r *http.Request) error
// ValidateToken validates an access token
ValidateToken(ctx context.Context, token string) error
}
type RegisterRequest ¶
type StorageType ¶
type StorageType string
const ( // StorageTypeMemory represents an in-memory store StorageTypeMemory StorageType = "memory" // StorageTypeRedis represents a Redis-based store StorageTypeRedis StorageType = "redis" )
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
Scope string `json:"scope,omitempty"`
}
TokenResponse represents the response from the token endpoint
Click to show internal directories.
Click to hide internal directories.