external

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRedirectURL

func CreateRedirectURL(konf *koanf.Koanf, providerType string) (string, error)

Types

type AccessProvider

type AccessProvider interface {
	AuthenticateExternalUser(ctx context.Context,
		email string, meta map[string]string) (string, error)
}

type ExternalProviderClaims

type ExternalProviderClaims struct {
	jwt.StandardClaims
	SiteURL  string `json:"site_url"`
	Provider string `json:"provider"`
}

func DecodeJwtClaims

func DecodeJwtClaims(ctx context.Context, konf *koanf.Koanf, state string) (*ExternalProviderClaims, error)

type OAuthProvider

type OAuthProvider interface {
	AuthCodeURL(string, ...oauth2.AuthCodeOption) string
	GetUserData(context.Context, *oauth2.Token) (*UserProvidedData, error)
	GetOAuthToken(string) (*oauth2.Token, error)
}

OAuthProvider specifies additional methods needed for providers using OAuth

func NewGoogleProvider

func NewGoogleProvider(konf *koanf.Koanf) (OAuthProvider, error)

NewGoogleProvider creates a Google account provider.

type UserProvidedData

type UserProvidedData struct {
	Email     string
	Verified  bool
	Name      string
	FirstName string
	LastName  string
	AvatarURL string
	Provider  string
}

func AuthenticateUser

func AuthenticateUser(ctx context.Context, konf *koanf.Koanf,
	state string, oauthCode string) (*UserProvidedData, error)

Jump to

Keyboard shortcuts

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