oauth

package
v0.0.0-...-cc1fd88 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.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 AuthProviderName

type AuthProviderName string
const (
	ProviderGoogle AuthProviderName = "GOOGLE"
)

func NewAuthProviderName

func NewAuthProviderName(provider string) (AuthProviderName, error)

func (AuthProviderName) String

func (a AuthProviderName) String() string

type OIDCProvider

type OIDCProvider interface {
	GetAuthURL(ctx context.Context, state string) string
	Exchange(ctx context.Context, code string) (*oauth2.Token, error)
	Verify(ctx context.Context, token *oauth2.Token) (string, *oidc.IDToken, error)
	GenerateState() string
	Client(ctx context.Context, token *oauth2.Token) *http.Client
	UserInfo(ctx context.Context, code string) (*UserInfo, error)
}

func NewOIDCProvider

func NewOIDCProvider(
	ctx context.Context,
	providerName AuthProviderName,
	issuerURL, clientID, clientSecret, redirectURL string,
	scopes []string,
) (OIDCProvider, error)

func OIDCProviderFactory

func OIDCProviderFactory(ctx context.Context, config *config.Config, providerName AuthProviderName) (OIDCProvider, error)

type UserInfo

type UserInfo struct {
	Subject string `json:"sub"`
	Name    string `json:"-"`
	Picture string `json:"picture"`
	Email   string `json:"email"`
}

Jump to

Keyboard shortcuts

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