Documentation ¶
Index ¶
- Constants
- func GenerateRandomString(prefix string, length int) string
- func GetUserIdFromSubject(subject string) string
- func SafeHTTPClient(client *http.Client, log zerolog.Logger) *http.Client
- func SafeRoundtripper(trans http.RoundTripper, log zerolog.Logger) http.RoundTripper
- func WithInstanceConfig(ctx context.Context, config *conf.Configuration, instanceID uuid.UUID) (context.Context, error)
- type API
- func (a *API) CreateInstance(w http.ResponseWriter, r *http.Request) error
- func (a *API) CreateInvitation(w http.ResponseWriter, r *http.Request) error
- func (a *API) DeleteInstance(w http.ResponseWriter, r *http.Request) error
- func (a *API) DeleteInvitation(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) GetAppManifest(w http.ResponseWriter, r *http.Request) error
- func (a *API) GetInstance(w http.ResponseWriter, r *http.Request) error
- func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error
- func (a *API) Invite(w http.ResponseWriter, r *http.Request) error
- func (a *API) ListInvitations(w http.ResponseWriter, r *http.Request) error
- func (a *API) ListenAndServe(hostAndPort string)
- func (a *API) Logout(w http.ResponseWriter, r *http.Request) error
- func (a *API) Mailer(ctx context.Context) mailer.Mailer
- func (a *API) OAuthProvider(ctx context.Context, name string) (provider.OAuthProvider, error)
- func (a *API) Provider(ctx context.Context, name string) (provider.Provider, 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) 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) Settings(w http.ResponseWriter, r *http.Request) error
- func (a *API) Signup(w http.ResponseWriter, r *http.Request) error
- func (a *API) Token(w http.ResponseWriter, r *http.Request) error
- func (a *API) UpdateInstance(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) VerifyInvitation(w http.ResponseWriter, r *http.Request) error
- type AccessTokenResponse
- type DeleteInvitationsParam
- type ErrorCause
- type ExternalProviderClaims
- type ExternalSignupParams
- type FunctionHooks
- type GoTrueClaims
- type HTTPError
- type HookEvent
- type InstanceRequestParams
- type InstanceResponse
- type InviteParams
- type JWKS
- type NetlifyMicroserviceClaims
- type OAuthError
- type OpenIdConfiguration
- type ProviderLabels
- type ProviderSettings
- type RecoverParams
- type Settings
- type SignupParams
- type TokenSigner
- type UserUpdateParams
- type VerifyInvitationParams
- type VerifyInvitationResponse
- type VerifyParams
- type Webhook
- type WebhookResponse
Constants ¶
const ( InvitationStatusPending = "PENDING" InvitationStatusAccepted = "ACCEPTED" )
const ( ValidateEvent = "validate" SignupEvent = "signup" LoginEvent = "login" )
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomString ¶
func GetUserIdFromSubject ¶
func SafeRoundtripper ¶
func SafeRoundtripper(trans http.RoundTripper, log zerolog.Logger) http.RoundTripper
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the main REST API
func NewAPI ¶
func NewAPI(globalConfig *conf.GlobalConfiguration, config *conf.Configuration, db *tigris.Database) *API
NewAPI instantiates a new REST API
func NewAPIFromConfigFile ¶
NewAPIFromConfigFile creates a new REST API using the provided configuration file.
func NewAPIWithVersion ¶
func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfiguration, config *conf.Configuration, db *tigris.Database, version string) *API
NewAPIWithVersion creates a new REST API using the specified version
func (*API) CreateInstance ¶
func (*API) CreateInvitation ¶
func (*API) DeleteInstance ¶
func (*API) DeleteInvitation ¶
func (*API) ExternalProviderCallback ¶
func (*API) ExternalProviderRedirect ¶
func (*API) GetAppManifest ¶
func (*API) GetInstance ¶
func (*API) HealthCheck ¶
HealthCheck ...
func (*API) Invite ¶
Invite is the endpoint for inviting a new user Tigris uses different Invitation flow that is handled at Invitation.go handler
func (*API) ListInvitations ¶
func (*API) ListenAndServe ¶
ListenAndServe starts the REST API
func (*API) Logout ¶
Logout is the endpoint for logging out a user and thereby revoking any refresh tokens
func (*API) OAuthProvider ¶
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 ¶
func (*API) UpdateInstance ¶
func (*API) UserUpdate ¶
UserUpdate updates fields on a user
func (*API) VerifyInvitation ¶
type AccessTokenResponse ¶
type AccessTokenResponse struct { Token string `json:"access_token"` TokenType string `json:"token_type"` // Bearer ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` }
AccessTokenResponse represents an OAuth2 success response
type DeleteInvitationsParam ¶
type ErrorCause ¶
type ErrorCause interface {
Cause() error
}
type ExternalProviderClaims ¶
type ExternalProviderClaims struct { NetlifyMicroserviceClaims Provider string `json:"provider"` InviteToken string `json:"invite_token,omitempty"` Referrer string `json:"referrer,omitempty"` }
type ExternalSignupParams ¶
SignupParams are the parameters the Signup endpoint accepts
type FunctionHooks ¶
func (*FunctionHooks) UnmarshalJSON ¶
func (f *FunctionHooks) UnmarshalJSON(b []byte) error
type GoTrueClaims ¶
type GoTrueClaims struct { jwt.StandardClaims TigrisMetadata map[string]interface{} `json:"https://tigris"` }
GoTrueClaims is a struct that used for JWT claims
type HTTPError ¶
type HTTPError struct { Code int `json:"code"` Message string `json:"msg"` InternalError error `json:"-"` InternalMessage string `json:"-"` ErrorID string `json:"error_id,omitempty"` }
HTTPError is an error with a message and an HTTP status code.
func (*HTTPError) WithInternalError ¶
WithInternalError adds internal error information to the error
func (*HTTPError) WithInternalMessage ¶
WithInternalMessage adds internal message information to the error
type InstanceRequestParams ¶
type InstanceRequestParams struct { UUID uuid.UUID `json:"uuid"` BaseConfig *conf.Configuration `json:"config"` }
type InstanceResponse ¶
type InviteParams ¶
InviteParams are the parameters the Signup endpoint accepts
type JWKS ¶
type JWKS struct {
// contains filtered or unexported fields
}
JWKS - public REST endpoints
func NewJKWS ¶
func NewJKWS(globalConfig *conf.GlobalConfiguration, config *conf.Configuration, version string) (*JWKS, error)
NewJKWS - constructs newer JWKS endpoint
type NetlifyMicroserviceClaims ¶
type NetlifyMicroserviceClaims struct { jwt.StandardClaims SiteURL string `json:"site_url"` InstanceID string `json:"id"` NetlifyID string `json:"netlify_id"` FunctionHooks FunctionHooks `json:"function_hooks"` }
type OAuthError ¶
type OAuthError struct { Err string `json:"error"` Description string `json:"error_description,omitempty"` InternalError error `json:"-"` InternalMessage string `json:"-"` }
OAuthError is the JSON handler for OAuth2 error responses
func (*OAuthError) Error ¶
func (e *OAuthError) Error() string
func (*OAuthError) WithInternalError ¶
func (e *OAuthError) WithInternalError(err error) *OAuthError
WithInternalError adds internal error information to the error
func (*OAuthError) WithInternalMessage ¶
func (e *OAuthError) WithInternalMessage(fmtString string, args ...interface{}) *OAuthError
WithInternalMessage adds internal message information to the error
type OpenIdConfiguration ¶
type OpenIdConfiguration struct {
// contains filtered or unexported fields
}
OpenIdConfiguration public rest endpoint
func NewOpenIdConfiguration ¶
func NewOpenIdConfiguration(globalConfig *conf.GlobalConfiguration, conf *conf.Configuration, version string) OpenIdConfiguration
type ProviderLabels ¶
type ProviderLabels struct {
SAML string `json:"saml,omitempty"`
}
type ProviderSettings ¶
type RecoverParams ¶
type RecoverParams struct {
Email string `json:"email"`
}
RecoverParams holds the parameters for a password recovery request
type Settings ¶
type Settings struct { ExternalProviders ProviderSettings `json:"external"` ExternalLabels ProviderLabels `json:"external_labels"` DisableSignup bool `json:"disable_signup"` Autoconfirm bool `json:"autoconfirm"` }
type SignupParams ¶
type SignupParams struct { Email string `json:"email"` Password string `json:"password"` Role string `json:"role"` Data map[string]interface{} `json:"data"` AppData models.UserAppMetadata `json:"app_data"` Provider string `json:"-"` Aud string `json:"-"` }
SignupParams are the parameters the Signup endpoint accepts
type TokenSigner ¶
type TokenSigner struct {
// contains filtered or unexported fields
}
TokenSigner is responsible to sign token, it supports HS256, RS256 algo
func NewTokenSigner ¶
func NewTokenSigner(config *conf.Configuration) *TokenSigner
NewTokenSigner - Returns new instance of TokenSinger
type UserUpdateParams ¶
type UserUpdateParams struct { Email string `json:"email"` Password string `json:"password"` EmailChangeToken string `json:"email_change_token"` Data map[string]interface{} `json:"data"` AppData *models.UserAppMetadata `json:"app_metadata,omitempty"` }
UserUpdateParams parameters for updating a user
type VerifyInvitationParams ¶
type VerifyParams ¶
type VerifyParams struct { Type string `json:"type"` Token string `json:"token"` Password string `json:"password"` }
VerifyParams are the parameters the Verify endpoint accepts
type Webhook ¶
type Webhook struct { *conf.WebhookConfig // contains filtered or unexported fields }
type WebhookResponse ¶
type WebhookResponse struct { AppMetaData *models.UserAppMetadata `json:"app_metadata,omitempty"` UserMetaData map[string]interface{} `json:"user_metadata,omitempty"` }
Source Files ¶
- Invitation.go
- admin.go
- api.go
- audit.go
- auth.go
- context.go
- errors.go
- external.go
- external_oauth.go
- external_saml.go
- helpers.go
- hooks.go
- instance.go
- invite.go
- jwks.go
- log.go
- logout.go
- mail.go
- middleware.go
- openid_configuration.go
- pagination.go
- recover.go
- router.go
- settings.go
- signup.go
- sorting.go
- token.go
- tracer.go
- user.go
- verify.go