Documentation
¶
Index ¶
- Constants
- Variables
- func FormatAPIVersion(apiVersion APIVersion) string
- func HandleHealth(w http.ResponseWriter, r *http.Request)
- func HandleLiveness(w http.ResponseWriter, r *http.Request)
- func HandleReadiness(db interface{ ... }, upstreamURLs map[string]string) http.HandlerFunc
- func HandleResponseError(err error, w http.ResponseWriter, r *http.Request)
- func IsSAMLMetadataStale(idpMetadata *saml.EntityDescriptor, samlProvider models.SAMLProvider) bool
- type API
- func (a *API) ChallengeFactor(w http.ResponseWriter, r *http.Request) error
- func (a *API) DeleteIdentity(w http.ResponseWriter, r *http.Request) error
- func (a *API) DeliverInboundSendEmailHook(r *http.Request, in *v0hooks.SendEmailInput) error
- func (a *API) EnrollFactor(w http.ResponseWriter, r *http.Request) error
- func (a *API) ExternalProviderCallback(w http.ResponseWriter, r *http.Request) error
- func (a *API) ExternalProviderRedirect(w http.ResponseWriter, r *http.Request) error
- func (a *API) GetConfig() *conf.GlobalConfiguration
- func (a *API) GetDB() *storage.Connection
- func (a *API) GetExternalProviderRedirectURL(w http.ResponseWriter, r *http.Request, linkingTargetUser *models.User) (string, error)
- func (a *API) GetTokenService() *tokens.Service
- func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error
- func (a *API) IdTokenGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (a *API) Invite(w http.ResponseWriter, r *http.Request) error
- func (a *API) LinkIdentity(w http.ResponseWriter, r *http.Request) error
- func (a *API) Logout(w http.ResponseWriter, r *http.Request) error
- func (a *API) MagicLink(w http.ResponseWriter, r *http.Request) error
- func (a *API) Mailer() mailer.Mailer
- func (a *API) Now() time.Time
- func (a *API) OAuthProvider(ctx context.Context, name string) (provider.OAuthProvider, conf.OAuthProviderConfiguration, error)
- func (a *API) Otp(w http.ResponseWriter, r *http.Request) error
- func (a *API) PKCE(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (a *API) PasskeyRegistrationOptions(w http.ResponseWriter, r *http.Request) error
- func (a *API) PasskeyRegistrationVerify(w http.ResponseWriter, r *http.Request) error
- func (a *API) Provider(ctx context.Context, name string, scopes string) (provider.Provider, conf.OAuthProviderConfiguration, error)
- func (a *API) Reauthenticate(w http.ResponseWriter, r *http.Request) error
- func (a *API) Recover(w http.ResponseWriter, r *http.Request) error
- func (a *API) RefreshTokenGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (a *API) Resend(w http.ResponseWriter, r *http.Request) error
- func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (a *API) SAMLMetadata(w http.ResponseWriter, r *http.Request) error
- func (a *API) SamlAcs(w http.ResponseWriter, r *http.Request) error
- func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (a *API) Settings(w http.ResponseWriter, r *http.Request) error
- func (a *API) Signup(w http.ResponseWriter, r *http.Request) error
- func (a *API) SignupAnonymously(w http.ResponseWriter, r *http.Request) error
- func (a *API) SingleSignOn(w http.ResponseWriter, r *http.Request) error
- func (a *API) SmsOtp(w http.ResponseWriter, r *http.Request) error
- func (a *API) Token(w http.ResponseWriter, r *http.Request) error
- func (a *API) UnenrollFactor(w http.ResponseWriter, r *http.Request) error
- func (a *API) UserGet(w http.ResponseWriter, r *http.Request) error
- func (a *API) UserUpdate(w http.ResponseWriter, r *http.Request) error
- func (a *API) Verify(w http.ResponseWriter, r *http.Request) error
- func (a *API) VerifyFactor(w http.ResponseWriter, r *http.Request) error
- func (a *API) Version() string
- func (a *API) Web3Grant(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (a *API) WellKnownJwks(w http.ResponseWriter, r *http.Request) error
- func (a *API) WellKnownOpenID(w http.ResponseWriter, r *http.Request) error
- type APIVersion
- type AccessTokenClaims
- type AccessTokenResponse
- type AdminCustomOAuthProviderParams
- type AdminListUsersResponse
- type AdminUserParams
- type AuthMicroserviceClaims
- type ChallengeFactorParams
- type ChallengeFactorResponse
- type CreateSSOProviderParams
- type EnrollFactorParams
- type EnrollFactorResponse
- type ErrorCause
- type FunctionHooks
- type GenerateLinkParams
- type GenerateLinkResponse
- type HTTPError
- type HTTPErrorResponse20240101
- type HealthCheckResponse
- type HealthResponse
- type IdTokenGrantParams
- type InviteParams
- type JwksResponse
- type LimiterOptions
- type LogoutBehavior
- type MagicLinkParams
- type OAuthError
- type OAuthProviderData
- type OpenIDConfigurationResponse
- type Option
- type OtpParams
- type PKCEGrantParams
- type PasskeyMetadataResponse
- type PasskeyRegistrationOptionsParams
- type PasskeyRegistrationOptionsResponse
- type PasskeyRegistrationVerifyParams
- type PasswordGrantParams
- type ProviderSettings
- type RecoverParams
- type RefreshTokenGrantParams
- type RequestParams
- type ResendConfirmationParams
- type SAMLAssertion
- func (a *SAMLAssertion) Attribute(name string) []saml.AttributeValue
- func (a *SAMLAssertion) Email() string
- func (a *SAMLAssertion) NotAfter() time.Time
- func (a *SAMLAssertion) NotBefore() time.Time
- func (a *SAMLAssertion) Process(mapping models.SAMLAttributeMapping) map[string]interface{}
- func (a *SAMLAssertion) SubjectID() (string, bool)
- func (a *SAMLAssertion) UserID() string
- type Settings
- type SignupParams
- type SingleSignOnParams
- type SingleSignOnResponse
- type SmsOtpResponse
- type SmsParams
- type TOTPObject
- type UnenrollFactorResponse
- type UserUpdateParams
- type VerifyFactorParams
- type VerifyParams
- type WeakPasswordError
- type Web3GrantParams
- type WebAuthnChallengeData
- type WebAuthnParams
- Bugs
Constants ¶
const ( DuplicateEmailMsg = "A user with this email address has already been registered" DuplicatePhoneMsg = "A user with this phone number has already been registered" )
Common error messages during signup flow
const ( PKCEPrefix = "pkce_" MinCodeChallengeLength = 43 MaxCodeChallengeLength = 128 InvalidPKCEParamsErrorMessage = "PKCE flow requires code_challenge_method and code_challenge" )
const ( EmailProvider = "email" PhoneProvider = "phone" )
Provider constants
const APIVersionHeaderName = "X-Supabase-Api-Version"
const DefaultQRSize = 3
const InvalidChannelError = "" /* 139-byte string literal not displayed */
const InvalidLoginMessage = "Invalid login credentials"
const InvalidNonceMessage = "Nonce has expired or is invalid"
const MaxPasswordLength = 72
BCrypt hashed passwords have a 72 character limit
const (
QRCodeGenerationErrorMessage = "Error generating QR Code"
)
const (
SAMLSubjectIDAttributeName = "urn:oasis:names:tc:SAML:attribute:subject-id"
)
Variables ¶
var ( APIVersionInitial = time.Time{} APIVersion20240101 = time.Date(2024, time.January, 1, 0, 0, 0, 0, time.UTC) )
var (
EmailRateLimitExceeded error = errors.New("email rate limit exceeded")
)
var (
UserExistsError error = errors.New("user already exists")
)
Functions ¶
func FormatAPIVersion ¶
func FormatAPIVersion(apiVersion APIVersion) string
func HandleHealth ¶
func HandleHealth(w http.ResponseWriter, r *http.Request)
HandleHealth returns basic health status
func HandleLiveness ¶
func HandleLiveness(w http.ResponseWriter, r *http.Request)
HandleLiveness returns liveness status (is the process running?)
func HandleReadiness ¶
func HandleReadiness(db interface{ Ping() error }, upstreamURLs map[string]string) http.HandlerFunc
HandleReadiness returns readiness status (can we serve requests?) Checks database connectivity and probes optional upstream URLs (2s timeout each). upstreamURLs is a map of label → URL probed with a HEAD request; a non-2xx response marks that check as degraded but does not make the overall status 503.
func HandleResponseError ¶
func HandleResponseError(err error, w http.ResponseWriter, r *http.Request)
func IsSAMLMetadataStale ¶
func IsSAMLMetadataStale(idpMetadata *saml.EntityDescriptor, samlProvider models.SAMLProvider) bool
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the main REST API
func NewAPI ¶
func NewAPI(globalConfig *conf.GlobalConfiguration, db *storage.Connection, opt ...Option) *API
NewAPI instantiates a new REST API
func NewAPIWithVersion ¶
func NewAPIWithVersion(globalConfig *conf.GlobalConfiguration, db *storage.Connection, version string, opt ...Option) *API
NewAPIWithVersion creates a new REST API using the specified version
func (*API) ChallengeFactor ¶
func (*API) DeleteIdentity ¶
func (*API) DeliverInboundSendEmailHook ¶
DeliverInboundSendEmailHook performs templated delivery for a verified send-email hook payload (same templates as the non-hook path). Caller must validate the Standard Webhooks signature first.
func (*API) EnrollFactor ¶
func (*API) ExternalProviderCallback ¶
ExternalProviderCallback handles the callback endpoint in the external oauth provider flow
func (*API) ExternalProviderRedirect ¶
ExternalProviderRedirect redirects the request to the oauth provider
func (*API) GetConfig ¶
func (a *API) GetConfig() *conf.GlobalConfiguration
func (*API) GetDB ¶
func (a *API) GetDB() *storage.Connection
func (*API) GetExternalProviderRedirectURL ¶
func (a *API) GetExternalProviderRedirectURL(w http.ResponseWriter, r *http.Request, linkingTargetUser *models.User) (string, error)
GetExternalProviderRedirectURL returns the URL to start the oauth flow with the corresponding oauth provider
func (*API) GetTokenService ¶
func (*API) HealthCheck ¶
HealthCheck endpoint indicates if the gotrue api service is available
func (*API) IdTokenGrant ¶
IdTokenGrant implements the id_token grant type flow
func (*API) LinkIdentity ¶
func (*API) Logout ¶
Logout is the endpoint for logging out a user and thereby revoking any refresh tokens
func (*API) OAuthProvider ¶
func (a *API) OAuthProvider(ctx context.Context, name string) (provider.OAuthProvider, conf.OAuthProviderConfiguration, error)
OAuthProvider returns the corresponding oauth provider as an OAuthProvider interface
func (*API) PasskeyRegistrationOptions ¶
PasskeyRegistrationOptions handles POST /passkeys/registration/options. Requires authentication. Generates WebAuthn registration options for adding a passkey to an existing account.
func (*API) PasskeyRegistrationVerify ¶
PasskeyRegistrationVerify handles POST /passkeys/registration/verify. Requires authentication. Verifies the WebAuthn credential and creates a passkey for the authenticated user.
func (*API) Provider ¶
func (a *API) Provider(ctx context.Context, name string, scopes string) (provider.Provider, conf.OAuthProviderConfiguration, error)
Provider returns a Provider interface for the given name.
func (*API) Reauthenticate ¶
Reauthenticate sends a reauthentication otp to either the user's email or phone
func (*API) RefreshTokenGrant ¶
RefreshTokenGrant implements the refresh_token grant type flow
func (*API) ResourceOwnerPasswordGrant ¶
func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error
ResourceOwnerPasswordGrant implements the password grant type flow
func (*API) SAMLMetadata ¶
SAMLMetadata serves GoTrue's SAML Service Provider metadata file.
func (*API) ServeHTTP ¶
func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface by passing the request along to its underlying Handler.
func (*API) SignupAnonymously ¶
func (*API) SingleSignOn ¶
SingleSignOn handles the single-sign-on flow for a provided SSO domain or provider.
func (*API) UnenrollFactor ¶
func (*API) UserUpdate ¶
UserUpdate updates fields on a user
func (*API) VerifyFactor ¶
func (*API) WellKnownJwks ¶
func (*API) WellKnownOpenID ¶
WellKnownOpenID handles both OIDC Discovery and OAuth 2.0 Authorization Server Metadata endpoints This unified handler serves: - GET /.well-known/openid-configuration (OIDC Discovery) - GET /.well-known/oauth-authorization-server (RFC 8414)
Both endpoints return the same comprehensive metadata since OIDC Discovery is a superset of OAuth 2.0 metadata
type APIVersion ¶
func DetermineClosestAPIVersion ¶
func DetermineClosestAPIVersion(date string) (APIVersion, error)
type AccessTokenClaims ¶
type AccessTokenClaims = tokens.AccessTokenClaims
Aliases for backward compatibility
type AccessTokenResponse ¶
type AccessTokenResponse = tokens.AccessTokenResponse
type AdminCustomOAuthProviderParams ¶
type AdminCustomOAuthProviderParams struct {
// Common fields
ProviderType string `json:"provider_type"` // "oauth2" or "oidc"
Identifier string `json:"identifier"`
Name string `json:"name"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
AcceptableClientIDs []string `json:"acceptable_client_ids,omitempty"`
Scopes []string `json:"scopes"`
PKCEEnabled *bool `json:"pkce_enabled,omitempty"`
AttributeMapping map[string]interface{} `json:"attribute_mapping,omitempty"`
AuthorizationParams map[string]interface{} `json:"authorization_params,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
EmailOptional *bool `json:"email_optional,omitempty"`
// OIDC-specific fields
Issuer string `json:"issuer,omitempty"`
DiscoveryURL *string `json:"discovery_url,omitempty"`
SkipNonceCheck *bool `json:"skip_nonce_check,omitempty"`
// OAuth2-specific fields
AuthorizationURL string `json:"authorization_url,omitempty"`
TokenURL string `json:"token_url,omitempty"`
UserinfoURL string `json:"userinfo_url,omitempty"`
JwksURI *string `json:"jwks_uri,omitempty"`
}
AdminCustomOAuthProviderParams defines parameters for creating/updating providers
type AdminListUsersResponse ¶
type AdminUserParams ¶
type AdminUserParams struct {
Id string `json:"id"`
Aud string `json:"aud"`
Role string `json:"role"`
Email string `json:"email"`
Phone string `json:"phone"`
Password *string `json:"password"`
PasswordHash string `json:"password_hash"`
EmailConfirm bool `json:"email_confirm"`
PhoneConfirm bool `json:"phone_confirm"`
UserMetaData map[string]interface{} `json:"user_metadata"`
AppMetaData map[string]interface{} `json:"app_metadata"`
BanDuration string `json:"ban_duration"`
}
type AuthMicroserviceClaims ¶
type AuthMicroserviceClaims struct {
jwt.RegisteredClaims
SiteURL string `json:"site_url"`
InstanceID string `json:"id"`
FunctionHooks FunctionHooks `json:"function_hooks"`
}
type ChallengeFactorParams ¶
type ChallengeFactorParams struct {
Channel string `json:"channel"`
WebAuthn *WebAuthnParams `json:"webauthn,omitempty"`
}
type ChallengeFactorResponse ¶
type ChallengeFactorResponse struct {
ID uuid.UUID `json:"id"`
Type string `json:"type"`
ExpiresAt int64 `json:"expires_at,omitempty"`
WebAuthn *WebAuthnChallengeData `json:"webauthn,omitempty"`
}
type CreateSSOProviderParams ¶
type CreateSSOProviderParams struct {
Type string `json:"type"`
MetadataURL string `json:"metadata_url"`
MetadataXML string `json:"metadata_xml"`
Domains []string `json:"domains"`
AttributeMapping models.SAMLAttributeMapping `json:"attribute_mapping"`
NameIDFormat string `json:"name_id_format"`
ResourceID *string `json:"resource_id,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
}
type EnrollFactorParams ¶
type EnrollFactorResponse ¶
type ErrorCause ¶
type ErrorCause interface {
Cause() error
}
ErrorCause is an error interface that contains the method Cause() for returning root cause errors
type FunctionHooks ¶
func (*FunctionHooks) UnmarshalJSON ¶
func (f *FunctionHooks) UnmarshalJSON(b []byte) error
type GenerateLinkParams ¶
type GenerateLinkResponse ¶
type HealthCheckResponse ¶
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Service string `json:"service"`
Version string `json:"version,omitempty"`
UptimeSeconds int64 `json:"uptime_seconds,omitempty"`
Checks map[string]string `json:"checks,omitempty"`
Error string `json:"error,omitempty"`
}
HealthResponse represents a health check response
type IdTokenGrantParams ¶
type IdTokenGrantParams struct {
IdToken string `json:"id_token"`
AccessToken string `json:"access_token"`
Nonce string `json:"nonce"`
Provider string `json:"provider"`
ClientID string `json:"client_id"`
Issuer string `json:"issuer"`
LinkIdentity bool `json:"link_identity"`
}
IdTokenGrantParams are the parameters the IdTokenGrant method accepts
type InviteParams ¶
InviteParams are the parameters the Signup endpoint accepts
type JwksResponse ¶
type LimiterOptions ¶
type LimiterOptions struct {
Email ratelimit.Limiter
Phone ratelimit.Limiter
Signups *limiter.Limiter
AnonymousSignIns *limiter.Limiter
Recover *limiter.Limiter
Resend *limiter.Limiter
MagicLink *limiter.Limiter
Otp *limiter.Limiter
Token *limiter.Limiter
Verify *limiter.Limiter
User *limiter.Limiter
FactorVerify *limiter.Limiter
FactorChallenge *limiter.Limiter
SSO *limiter.Limiter
SAMLAssertion *limiter.Limiter
Web3 *limiter.Limiter
OAuthClientRegister *limiter.Limiter
}
func NewLimiterOptions ¶
func NewLimiterOptions(gc *conf.GlobalConfiguration) *LimiterOptions
type LogoutBehavior ¶
type LogoutBehavior string
const ( LogoutGlobal LogoutBehavior = "global" LogoutLocal LogoutBehavior = "local" LogoutOthers LogoutBehavior = "others" )
type MagicLinkParams ¶
type MagicLinkParams struct {
Email string `json:"email"`
Data map[string]interface{} `json:"data"`
CodeChallengeMethod string `json:"code_challenge_method"`
CodeChallenge string `json:"code_challenge"`
}
MagicLinkParams holds the parameters for a magic link request
func (*MagicLinkParams) Validate ¶
func (p *MagicLinkParams) Validate(a *API) error
type OAuthError ¶
type OAuthError = apierrors.OAuthError
Type aliases while we slowly refactor api errors.
type OAuthProviderData ¶
type OAuthProviderData struct {
// contains filtered or unexported fields
}
OAuthProviderData contains the userData and token returned by the oauth provider
type OpenIDConfigurationResponse ¶
type OpenIDConfigurationResponse struct {
// Core Discovery Fields (Required by both OIDC and OAuth 2.0)
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
JWKSURL string `json:"jwks_uri"`
UserInfoEndpoint string `json:"userinfo_endpoint,omitempty"` // OIDC-specific
RegistrationEndpoint string `json:"registration_endpoint,omitempty"`
// Supported Parameters
ScopesSupported []string `json:"scopes_supported,omitempty"`
ResponseTypesSupported []string `json:"response_types_supported"`
ResponseModesSupported []string `json:"response_modes_supported,omitempty"`
GrantTypesSupported []string `json:"grant_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"` // OIDC-specific
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"` // OIDC-specific
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
ClaimsSupported []string `json:"claims_supported,omitempty"` // OIDC-specific
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"` // OAuth 2.1/PKCE
}
OpenIDConfigurationResponse represents both OIDC Discovery and OAuth 2.0 Authorization Server Metadata This unified response serves both: - /.well-known/openid-configuration (OIDC Discovery per OpenID Connect Discovery 1.0) - /.well-known/oauth-authorization-server (OAuth Authorization Server Metadata per RFC 8414)
Since OIDC Discovery extends RFC 8414, a single response structure satisfies both specifications.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithMailer ¶
func WithTokenService ¶
type OtpParams ¶
type OtpParams struct {
Email string `json:"email"`
Phone string `json:"phone"`
CreateUser bool `json:"create_user"`
Data map[string]interface{} `json:"data"`
Channel string `json:"channel"`
CodeChallengeMethod string `json:"code_challenge_method"`
CodeChallenge string `json:"code_challenge"`
}
OtpParams contains the request body params for the otp endpoint
type PKCEGrantParams ¶
type PKCEGrantParams struct {
AuthCode string `json:"auth_code"`
CodeVerifier string `json:"code_verifier"`
}
PKCEGrantParams are the parameters the PKCEGrant method accepts
type PasskeyMetadataResponse ¶
type PasskeyMetadataResponse struct {
ID string `json:"id"`
FriendlyName string `json:"friendly_name,omitempty"`
CreatedAt time.Time `json:"created_at"`
BackupEligible bool `json:"backup_eligible"`
BackedUp bool `json:"backed_up"`
Transports []protocol.AuthenticatorTransport `json:"transports"`
}
PasskeyMetadataResponse is the response body for successful passkey creation.
type PasskeyRegistrationOptionsParams ¶
type PasskeyRegistrationOptionsParams struct{}
PasskeyRegistrationOptionsParams is the request body for POST /passkeys/registration/options.
type PasskeyRegistrationOptionsResponse ¶
type PasskeyRegistrationOptionsResponse struct {
ChallengeID string `json:"challenge_id"`
Options *protocol.CredentialCreation `json:"options"`
ExpiresAt int64 `json:"expires_at"`
}
PasskeyRegistrationOptionsResponse is the response body for POST /passkeys/registration/options.
type PasskeyRegistrationVerifyParams ¶
type PasskeyRegistrationVerifyParams struct {
ChallengeID string `json:"challenge_id"`
CredentialResponse json.RawMessage `json:"credential_response"`
}
PasskeyRegistrationVerifyParams is the request body for POST /passkeys/registration/verify.
type PasswordGrantParams ¶
type PasswordGrantParams struct {
Email string `json:"email"`
Phone string `json:"phone"`
Password string `json:"password"`
}
PasswordGrantParams are the parameters the ResourceOwnerPasswordGrant method accepts
type ProviderSettings ¶
type ProviderSettings struct {
AnonymousUsers bool `json:"anonymous_users"`
Apple bool `json:"apple"`
Azure bool `json:"azure"`
Bitbucket bool `json:"bitbucket"`
Discord bool `json:"discord"`
Facebook bool `json:"facebook"`
Snapchat bool `json:"snapchat"`
Figma bool `json:"figma"`
Fly bool `json:"fly"`
GitHub bool `json:"github"`
GitLab bool `json:"gitlab"`
Google bool `json:"google"`
Keycloak bool `json:"keycloak"`
Kakao bool `json:"kakao"`
Linkedin bool `json:"linkedin"`
LinkedinOIDC bool `json:"linkedin_oidc"`
Notion bool `json:"notion"`
Spotify bool `json:"spotify"`
Slack bool `json:"slack"`
SlackOIDC bool `json:"slack_oidc"`
WorkOS bool `json:"workos"`
Twitch bool `json:"twitch"`
Twitter bool `json:"twitter"`
Email bool `json:"email"`
Phone bool `json:"phone"`
Zoom bool `json:"zoom"`
}
type RecoverParams ¶
type RecoverParams struct {
Email string `json:"email"`
CodeChallenge string `json:"code_challenge"`
CodeChallengeMethod string `json:"code_challenge_method"`
}
RecoverParams holds the parameters for a password recovery request
func (*RecoverParams) Validate ¶
func (p *RecoverParams) Validate(a *API) error
type RefreshTokenGrantParams ¶
type RefreshTokenGrantParams struct {
RefreshToken string `json:"refresh_token"`
}
RefreshTokenGrantParams are the parameters the RefreshTokenGrant method accepts
func (*RefreshTokenGrantParams) Validate ¶
func (p *RefreshTokenGrantParams) Validate() error
type RequestParams ¶
type RequestParams interface {
AdminUserParams |
AdminCustomOAuthProviderParams |
CreateSSOProviderParams |
EnrollFactorParams |
GenerateLinkParams |
IdTokenGrantParams |
InviteParams |
OtpParams |
PKCEGrantParams |
PasswordGrantParams |
RecoverParams |
RefreshTokenGrantParams |
ResendConfirmationParams |
SignupParams |
SingleSignOnParams |
SmsParams |
Web3GrantParams |
UserUpdateParams |
VerifyFactorParams |
VerifyParams |
adminUserUpdateFactorParams |
adminUserDeleteParams |
security.GotrueRequest |
ChallengeFactorParams |
struct {
Email string `json:"email"`
Phone string `json:"phone"`
} |
struct {
Email string `json:"email"`
}
}
type ResendConfirmationParams ¶
type ResendConfirmationParams struct {
Type string `json:"type"`
Email string `json:"email"`
Phone string `json:"phone"`
}
ResendConfirmationParams holds the parameters for a resend request
func (*ResendConfirmationParams) Validate ¶
func (p *ResendConfirmationParams) Validate(a *API) error
type SAMLAssertion ¶
func (*SAMLAssertion) Attribute ¶
func (a *SAMLAssertion) Attribute(name string) []saml.AttributeValue
Attribute returns the first matching attribute value in the attribute statements where name equals the official SAML attribute Name or FriendlyName. Returns nil if such an attribute can't be found.
func (*SAMLAssertion) Email ¶
func (a *SAMLAssertion) Email() string
Email returns the best guess for an email address.
func (*SAMLAssertion) NotAfter ¶
func (a *SAMLAssertion) NotAfter() time.Time
NotAfter extracts the time at which or after this assertion should not be considered.
func (*SAMLAssertion) NotBefore ¶
func (a *SAMLAssertion) NotBefore() time.Time
NotBefore extracts the time before which this assertion should not be considered.
func (*SAMLAssertion) Process ¶
func (a *SAMLAssertion) Process(mapping models.SAMLAttributeMapping) map[string]interface{}
Process processes this assertion according to the SAMLAttributeMapping. Never returns nil.
func (*SAMLAssertion) SubjectID ¶
func (a *SAMLAssertion) SubjectID() (string, bool)
SubjectID returns the user identifier in present in the Subject section of the SAML assertion. Note that this way of identifying the Subject is generally superseded by the SAMLSubjectIDAttributeName assertion attribute; tho must be present in all assertions. It can have a few formats, of which the most important are: saml.EmailAddressNameIDFormat (meaning the user ID is an email address), saml.PersistentNameIDFormat (the user ID is an opaque string that does not change with each assertion, e.g. UUID), saml.TransientNameIDFormat (the user ID changes with each assertion -- can't be used to identify a user). The boolean returned identifies if the user ID is persistent. If it's an email address, it's lowercased just in case.
func (*SAMLAssertion) UserID ¶
func (a *SAMLAssertion) UserID() string
UserID returns the best choice for a persistent user identifier on the Identity Provider side. Don't assume the format of the string returned, as it's Identity Provider specific.
type Settings ¶
type Settings struct {
ExternalProviders ProviderSettings `json:"external"`
DisableSignup bool `json:"disable_signup"`
MailerAutoconfirm bool `json:"mailer_autoconfirm"`
PhoneAutoconfirm bool `json:"phone_autoconfirm"`
SmsProvider string `json:"sms_provider"`
SAMLEnabled bool `json:"saml_enabled"`
PasskeysEnabled bool `json:"passkeys_enabled"`
}
type SignupParams ¶
type SignupParams struct {
Email string `json:"email"`
Phone string `json:"phone"`
Password string `json:"password"`
Data map[string]interface{} `json:"data"`
Provider string `json:"-"`
Aud string `json:"-"`
Channel string `json:"channel"`
CodeChallengeMethod string `json:"code_challenge_method"`
CodeChallenge string `json:"code_challenge"`
}
SignupParams are the parameters the Signup endpoint accepts
func (*SignupParams) ConfigureDefaults ¶
func (p *SignupParams) ConfigureDefaults()
func (*SignupParams) ToUserModel ¶
func (params *SignupParams) ToUserModel(isSSOUser bool) (user *models.User, err error)
type SingleSignOnParams ¶
type SingleSignOnResponse ¶
type SingleSignOnResponse struct {
URL string `json:"url"`
}
type SmsOtpResponse ¶
type SmsOtpResponse struct {
MessageID string `json:"message_id,omitempty"`
}
type SmsParams ¶
type SmsParams struct {
Phone string `json:"phone"`
Channel string `json:"channel"`
Data map[string]interface{} `json:"data"`
CodeChallengeMethod string `json:"code_challenge_method"`
CodeChallenge string `json:"code_challenge"`
}
SmsParams contains the request body params for sms otp
type TOTPObject ¶
type UnenrollFactorResponse ¶
type UserUpdateParams ¶
type UserUpdateParams struct {
Email string `json:"email"`
Password *string `json:"password"`
CurrentPassword *string `json:"current_password,omitempty"`
Nonce string `json:"nonce"`
Data map[string]interface{} `json:"data"`
AppData map[string]interface{} `json:"app_metadata,omitempty"`
Phone string `json:"phone"`
Channel string `json:"channel"`
CodeChallenge string `json:"code_challenge"`
CodeChallengeMethod string `json:"code_challenge_method"`
}
UserUpdateParams parameters for updating a user
type VerifyFactorParams ¶
type VerifyFactorParams struct {
ChallengeID uuid.UUID `json:"challenge_id"`
Code string `json:"code"`
WebAuthn *WebAuthnParams `json:"webauthn,omitempty"`
}
type VerifyParams ¶
type VerifyParams struct {
Type string `json:"type"`
Token string `json:"token"`
TokenHash string `json:"token_hash"`
Email string `json:"email"`
Phone string `json:"phone"`
RedirectTo string `json:"redirect_to"`
}
VerifyParams are the parameters the Verify endpoint accepts
type WeakPasswordError ¶
type WeakPasswordError struct {
Message string `json:"message,omitempty"`
Reasons []string `json:"reasons,omitempty"`
}
WeakPasswordError encodes an error that a password does not meet strength requirements. It is handled specially in errors.go as it gets transformed to a HTTPError with a special weak_password field that encodes the Reasons slice.
func (*WeakPasswordError) Error ¶
func (e *WeakPasswordError) Error() string
type Web3GrantParams ¶
type WebAuthnChallengeData ¶
type WebAuthnChallengeData struct {
Type string `json:"type"` // "create" or "request"
CredentialOptions interface{} `json:"credential_options"`
}
type WebAuthnParams ¶
type WebAuthnParams struct {
RPID string `json:"rpId,omitempty"`
RPOrigins []string `json:"rpOrigins,omitempty"`
Type string `json:"type"` // "create" or "request"
CredentialResponse json.RawMessage `json:"credential_response"`
}
Notes ¶
Bugs ¶
This introduced a bug which mismatched the token and hash fields, such that:
EmailData.TokenHashNew = Hash(CurEmail, EmailData.Token) EmailData.TokenHash = Hash(NewEmail, EmailData.TokenNew)
Specifically with email changes we should look to fix this behavior in a BC way to maintain that:
Token Always contains the Token for user.email TokenHash Always contains the Hash for user.email Token Always contains the Token for user.email_new TokenHash Always contains the Hash for user.email_new
This matches the current behavior but is not intuitive and should be changed in a future release. See the comment above for more details.
Source Files
¶
- admin.go
- admin_mail_templates.go
- anonymous.go
- api.go
- apiversions.go
- audit.go
- auth.go
- context.go
- custom_oauth_admin.go
- errors.go
- external.go
- external_oauth.go
- health.go
- helpers.go
- hooks.go
- identity.go
- invite.go
- jwks.go
- logout.go
- magic_link.go
- mail.go
- mfa.go
- middleware.go
- options.go
- otp.go
- pagination.go
- passkey_registration.go
- passkey_webauthn.go
- password.go
- phone.go
- pkce.go
- provider_constants.go
- reauthenticate.go
- recover.go
- redirect.go
- resend.go
- router.go
- saml.go
- samlacs.go
- samlassertion.go
- settings.go
- signup.go
- sorting.go
- sso.go
- ssoadmin.go
- token.go
- token_oidc.go
- token_refresh.go
- user.go
- verify.go
- web3.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apitask provides a background execution context for background work that limits the execution time to the current request.
|
Package apitask provides a background execution context for background work that limits the execution time to the current request. |