oauth

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuth2

type OAuth2 struct {
	Enable    bool
	Providers map[string]*Provider
}

func NewOAuth2

func NewOAuth2() (*OAuth2, error)

func (*OAuth2) Auth

func (f *OAuth2) Auth(ctx context.Context, code, provider string) (*oauth2.Token, error)

func (*OAuth2) Redirect

func (f *OAuth2) Redirect(state string, provider string) string

func (*OAuth2) UserInfo

func (f *OAuth2) UserInfo(ctx context.Context, token *oauth2.Token, provider string) (any, error)

type OAuth2ProviderConfig

type OAuth2ProviderConfig struct {
	UserInfoUrl  string   `mapstructure:"userInfoUrl"`
	ClientId     string   `mapstructure:"clientId"`
	ClientSecret string   `mapstructure:"clientSecret"`
	Scopes       []string `mapstructure:"scopes"`
	AuthUrl      string   `mapstructure:"authUrl"`
	TokenUrl     string   `mapstructure:"tokenUrl"`
	RedirectUrl  string   `mapstructure:"redirectUrl"`
}

type Provider

type Provider struct {
	UserInfoUrl string
	OAuthConfig *oauth2.Config
}

Jump to

Keyboard shortcuts

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