providers

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscordProvider

type DiscordProvider struct {
	// contains filtered or unexported fields
}

func NewDiscordProvider

func NewDiscordProvider(config *models.OAuth2Config) *DiscordProvider

func (*DiscordProvider) Exchange

func (p *DiscordProvider) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

func (*DiscordProvider) GetAuthURL

func (p *DiscordProvider) GetAuthURL(state string, opts ...oauth2.AuthCodeOption) string

func (*DiscordProvider) GetConfig

func (p *DiscordProvider) GetConfig() *oauth2.Config

func (*DiscordProvider) GetName

func (p *DiscordProvider) GetName() string

func (*DiscordProvider) GetUserInfo

func (p *DiscordProvider) GetUserInfo(ctx context.Context, token *oauth2.Token) (*models.OAuth2UserInfo, error)

func (*DiscordProvider) RequiresPKCE

func (p *DiscordProvider) RequiresPKCE() bool

type DiscordUser

type DiscordUser struct {
	ID       string `json:"id"`
	Email    string `json:"email"`
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
	Verified bool   `json:"verified"`
}

type GitHubEmailInfo

type GitHubEmailInfo struct {
	Email    string `json:"email"`
	Primary  bool   `json:"primary"`
	Verified bool   `json:"verified"`
}

type GitHubProvider

type GitHubProvider struct {
	// contains filtered or unexported fields
}

func NewGitHubProvider

func NewGitHubProvider(config *models.OAuth2Config) *GitHubProvider

func (*GitHubProvider) Exchange

func (p *GitHubProvider) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

func (*GitHubProvider) GetAuthURL

func (p *GitHubProvider) GetAuthURL(state string, opts ...oauth2.AuthCodeOption) string

func (*GitHubProvider) GetConfig

func (p *GitHubProvider) GetConfig() *oauth2.Config

func (*GitHubProvider) GetName

func (p *GitHubProvider) GetName() string

func (*GitHubProvider) GetUserInfo

func (p *GitHubProvider) GetUserInfo(ctx context.Context, token *oauth2.Token) (*models.OAuth2UserInfo, error)

func (*GitHubProvider) RequiresPKCE

func (p *GitHubProvider) RequiresPKCE() bool

type GitHubUser

type GitHubUser struct {
	ID        int    `json:"id"`
	Email     string `json:"email"`
	Name      string `json:"name"`
	AvatarURL string `json:"avatar_url"`
	Login     string `json:"login"`
}

type GoogleProvider

type GoogleProvider struct {
	// contains filtered or unexported fields
}

func NewGoogleProvider

func NewGoogleProvider(config *models.OAuth2Config) *GoogleProvider

func (*GoogleProvider) Exchange

func (p *GoogleProvider) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

func (*GoogleProvider) GetAuthURL

func (p *GoogleProvider) GetAuthURL(state string, opts ...oauth2.AuthCodeOption) string

func (*GoogleProvider) GetConfig

func (p *GoogleProvider) GetConfig() *oauth2.Config

func (*GoogleProvider) GetName

func (p *GoogleProvider) GetName() string

func (*GoogleProvider) GetUserInfo

func (p *GoogleProvider) GetUserInfo(ctx context.Context, token *oauth2.Token) (*models.OAuth2UserInfo, error)

func (*GoogleProvider) RequiresPKCE

func (p *GoogleProvider) RequiresPKCE() bool

type GoogleUser

type GoogleUser struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
}

type OAuth2Provider

type OAuth2Provider interface {
	GetName() string
	GetConfig() *oauth2.Config
	RequiresPKCE() bool
	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) (*models.OAuth2UserInfo, error)
}

OAuth2Provider defines the interface for OAuth2 providers.

type OAuth2ProviderRegistry

type OAuth2ProviderRegistry struct {
	// contains filtered or unexported fields
}

func NewOAuth2ProviderRegistry

func NewOAuth2ProviderRegistry() *OAuth2ProviderRegistry

func (*OAuth2ProviderRegistry) Get

func (*OAuth2ProviderRegistry) Register

func (r *OAuth2ProviderRegistry) Register(provider OAuth2Provider)

Jump to

Keyboard shortcuts

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