Documentation ¶
Overview ¶
Package oauth2 contains the domain concept definitions needed to support Magistrala ui service OAuth2 functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ClientID string `env:"CLIENT_ID" envDefault:""` ClientSecret string `env:"CLIENT_SECRET" envDefault:""` State string `env:"STATE" envDefault:""` RedirectURL string `env:"REDIRECT_URL" envDefault:""` }
Config is the configuration for the OAuth2 provider.
type Provider ¶
type Provider interface { // Name returns the name of the OAuth2 provider. Name() string // State returns the current state for the OAuth2 flow. State() string // RedirectURL returns the URL to redirect the user to after completing the OAuth2 flow. RedirectURL() string // ErrorURL returns the URL to redirect the user to in case of an error during the OAuth2 flow. ErrorURL() string // IsEnabled checks if the OAuth2 provider is enabled. IsEnabled() bool // Exchange converts an authorization code into a token. Exchange(ctx context.Context, code string) (oauth2.Token, error) // UserInfo retrieves the user's information using the access token. UserInfo(accessToken string) (mfclients.Client, error) }
Provider is an interface that provides the OAuth2 flow for a specific provider (e.g. Google, GitHub, etc.)
Click to show internal directories.
Click to hide internal directories.