types

package
v2.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeRequest

type AuthorizeRequest struct {
	ProviderID string
	RedirectTo string
}

AuthorizeRequest represents an authorization request

type AuthorizeResponse

type AuthorizeResponse struct {
	AuthURL string `json:"auth_url"`
}

AuthorizeResponse represents an authorization response

type CallbackRequest

type CallbackRequest struct {
	ProviderID string
	Code       string
	State      string
	Error      string
}

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

type CallbackResult struct {
	User         *models.User
	Session      *models.Session
	SessionToken string
}

CallbackResult represents the result of OAuth2 callback

type LinkAccountRequest

type LinkAccountRequest struct {
	Provider   string
	UserID     string
	RedirectTo string
}

LinkAccountRequest represents an account linking request

type LinkAccountResponse

type LinkAccountResponse struct {
	User *models.User `json:"user,omitempty"`
}

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

type RefreshRequest struct {
	Provider string
	UserID   string
}

RefreshRequest represents a token refresh request

type RefreshResponse

type RefreshResponse struct {
	AccessToken string    `json:"access_token"`
	TokenType   string    `json:"token_type"`
	ExpiresIn   int       `json:"expires_in"`
	ExpiresAt   time.Time `json:"expires_at"`
}

RefreshResponse represents a token refresh response

type UserInfo

type UserInfo struct {
	ProviderAccountID string          `json:"provider_account_id"`
	Email             string          `json:"email"`
	Name              string          `json:"name"`
	Picture           string          `json:"picture"`
	Raw               json.RawMessage `json:"raw"`
}

UserInfo represents normalized user information from OAuth2 providers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL