Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizeRequest ¶
AuthorizeRequest represents an authorization request
type AuthorizeResponse ¶
type AuthorizeResponse struct {
AuthURL string `json:"auth_url"`
}
AuthorizeResponse represents an authorization response
type CallbackRequest ¶
CallbackRequest represents an OAuth2 callback request
type CallbackResponse ¶
type CallbackResponse struct {
User *models.User `json:"user"`
Session *models.Session `json:"session"`
}
CallbackResponse represents an OAuth2 callback response
type CallbackResult ¶
CallbackResult represents the result of OAuth2 callback
type LinkAccountRequest ¶
LinkAccountRequest represents an account linking request
type LinkAccountResponse ¶
LinkAccountResponse represents an account linking response
type OAuth2PluginConfig ¶
type OAuth2PluginConfig struct {
Enabled bool `json:"enabled" toml:"enabled"`
Providers map[string]ProviderConfig `json:"providers" toml:"providers"`
}
OAuth2PluginConfig represents the OAuth2 plugin configuration
func (*OAuth2PluginConfig) ApplyDefaults ¶
func (c *OAuth2PluginConfig) ApplyDefaults()
ApplyDefaults applies default values to the config
type OAuth2Provider ¶
type OAuth2Provider interface {
Name() string
GetConfig() *oauth2.Config
GetAuthURL(state string, opts ...oauth2.AuthCodeOption) string
Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
GetUserInfo(ctx context.Context, token *oauth2.Token) (*UserInfo, error)
RequiresPKCE() bool
}
OAuth2Provider interface defines the contract for OAuth2 providers
type ProviderConfig ¶
type ProviderConfig struct {
Enabled bool `json:"enabled" toml:"enabled"`
ClientID string `json:"client_id" toml:"client_id"`
ClientSecret string `json:"client_secret" toml:"client_secret"`
RedirectURL string `json:"redirect_url" toml:"redirect_url"`
Scopes []string `json:"scopes" toml:"scopes"`
AuthURL string `json:"auth_url" toml:"auth_url"`
TokenURL string `json:"token_url" toml:"token_url"`
UserInfoURL string `json:"user_info_url" toml:"user_info_url"`
UserIDField string `json:"user_id_field" toml:"user_id_field"`
EmailField string `json:"email_field" toml:"email_field"`
NameField string `json:"name_field" toml:"name_field"`
PictureField string `json:"picture_field" toml:"picture_field"`
}
ProviderConfig represents configuration for an OAuth2 provider
type RefreshRequest ¶
RefreshRequest represents a token refresh request