Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MapFallbackEmail ¶
func MapFallbackEmail(root any, fallback FallbackLookup) (string, bool)
Types ¶
type AppleJWTSecret ¶
type ClientSecret ¶
type ClientSecret struct {
Value string
Env string
Strategy string
AppleJWT *AppleJWTSecret
}
func (ClientSecret) ResolveStatic ¶
func (s ClientSecret) ResolveStatic() (string, error)
type FallbackLookup ¶
type FallbackLookup struct {
URL string
Accept string
Array bool
Select map[string]any
Email FieldMapping
EmailVerified FieldMapping
}
type FieldMapping ¶
type Identity ¶
type Identity struct {
Subject string
Email string
EmailVerified bool
PreferredUsername string
DisplayName string
}
func MapIdentity ¶
func MapIdentity(root any, mapping UserMapping) (Identity, error)
type Provider ¶
type Provider struct {
Name string
Kind Kind
Issuer string
ClientID string
ClientSecret ClientSecret
Scopes []string
PKCE bool
AuthorizeURL string
TokenURL string
UserInfoURL string
UserInfoAccept string
ExtraAuthParams map[string]string
UserMapping UserMapping
EmailFallback *FallbackLookup
// IdentityMapper is an internal escape hatch for providers whose userinfo
// response cannot be represented by declarative mappings.
IdentityMapper func(any) (Identity, error)
// SecretProvider is the internal escape hatch for callers that already
// construct dynamic secrets in code. Config-first providers should prefer
// ClientSecret strategies.
SecretProvider func(context.Context) (string, error)
}
func Apple ¶ added in v0.72.0
Apple returns the built-in Apple OIDC provider configured with the given OAuth client credentials. For the Apple "client secret JWT" strategy, set ClientSecret.Strategy / ClientSecret.AppleJWT on the returned provider.
func Discord ¶ added in v0.72.0
Discord returns the built-in Discord OAuth2 provider configured with the given OAuth client credentials.
func GitHub ¶ added in v0.72.0
GitHub returns the built-in GitHub OAuth2 provider configured with the given OAuth client credentials.
func Google ¶ added in v0.72.0
Google returns the built-in Google OIDC provider configured with the given OAuth client credentials — the convenience form of an authprovider.Provider for IdentityConfig.Providers (#143). Override fields on the result for custom scopes/mapping.
func (Provider) NormalizedName ¶
type UserMapping ¶
type UserMapping struct {
Subject FieldMapping
Email FieldMapping
EmailVerified FieldMapping
PreferredUsername FieldMapping
DisplayName FieldMapping
}