Documentation ¶
Index ¶
- Variables
- func RegisterProvider(provider ...Provider)
- type AuthIntent
- type AuthParams
- type Provider
- type ProviderType
- type Providers
- type UnimplementedProvider
- func (u *UnimplementedProvider) BeginAuth(_ context.Context, _ adapters.Adapter, state string, params AuthParams) (AuthIntent, error)
- func (u *UnimplementedProvider) CompleteAuth(_ context.Context, _ adapters.Adapter, params AuthParams) (adapters.GothUser, error)
- func (u *UnimplementedProvider) Debug(debug bool)
- func (u *UnimplementedProvider) ID() string
- func (u *UnimplementedProvider) Name() string
- func (u *UnimplementedProvider) Type() ProviderType
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = &http.Client{ Transport: &http.Transport{ MaxIdleConnsPerHost: 20, }, Timeout: 10 * time.Second, }
DefaultClient is the default HTTP client used.
var ErrNoAuthURL = errors.New("an AuthURL has not been set")
ErrNoAuthURL is returned when an AuthURL has not been set.
var ErrUnimplemented = errors.New("not implemented")
ErrUnimplemented is returned when a method is not implemented.
Functions ¶
func RegisterProvider ¶
func RegisterProvider(provider ...Provider)
RegisterProvider adds a provider to the list of available providers for use with Goth.
Types ¶
type AuthIntent ¶
type AuthIntent interface { // GetAuthURL returns the URL for the authentication end-point. GetAuthURL() (string, error) }
AuthIntent is the type of authentication intent.
type AuthParams ¶
AuthParams is the type of authentication parameters.
type Provider ¶
type Provider interface { // ID returns the provider's ID. ID() string // Debug sets the provider's debug mode. Debug(bool) // Name returns the provider's name. Name() string // Type returns the provider's type. Type() ProviderType // BeginAuth starts the authentication process. BeginAuth(ctx context.Context, adapter adapters.Adapter, state string, params AuthParams) (AuthIntent, error) // CompleteAuth completes the authentication process. CompleteAuth(ctx context.Context, adapter adapters.Adapter, params AuthParams) (adapters.GothUser, error) }
Provider needs to be implemented for each 3rd party authentication provider.
func GetProvider ¶
GetProvider returns a previously created provider. If Goth has not been told to use the named provider it will return an error.
type ProviderType ¶
type ProviderType string
PrioviderType is the type of provider.
const ( // ProviderTypeOAuth2 represents an OAuth2 account type. ProviderTypeOAuth2 ProviderType = "oauth2" // ProviderTypeOIDC represents an OIDC account type. ProviderTypeOIDC ProviderType = "oidc" // ProviderTypeSAML represents a SAML account type. ProviderTypeSAML ProviderType = "saml" // ProviderTypeEmail represents an email account type. ProviderTypeEmail ProviderType = "email" // ProviderTypeWebAuthn represents a WebAuthn account type. ProviderTypeWebAuthn ProviderType = "webauthn" // ProviderTypeUnknown represents an unknown account type. ProviderTypeUnknown ProviderType = "unknow" )
type Providers ¶
Providers is list of known/available providers.
func GetProviders ¶
func GetProviders() Providers
GetProviders returns a list of all the providers currently in use.
type UnimplementedProvider ¶
type UnimplementedProvider struct {
// contains filtered or unexported fields
}
UnimplementedProvider is a placeholder for a provider that has not been implemented.
func (*UnimplementedProvider) BeginAuth ¶
func (u *UnimplementedProvider) BeginAuth(_ context.Context, _ adapters.Adapter, state string, params AuthParams) (AuthIntent, error)
BeginAuth starts the authentication process.
func (*UnimplementedProvider) CompleteAuth ¶
func (u *UnimplementedProvider) CompleteAuth(_ context.Context, _ adapters.Adapter, params AuthParams) (adapters.GothUser, error)
CompleteAuth completes the authentication process.
func (*UnimplementedProvider) Debug ¶
func (u *UnimplementedProvider) Debug(debug bool)
Debug sets the provider's debug mode.
func (*UnimplementedProvider) ID ¶
func (u *UnimplementedProvider) ID() string
ID returns the provider's ID.
func (*UnimplementedProvider) Name ¶
func (u *UnimplementedProvider) Name() string
Name returns the provider's name.
func (*UnimplementedProvider) Type ¶
func (u *UnimplementedProvider) Type() ProviderType
Type returns the provider's type.