Documentation
¶
Index ¶
- func GetEnabledProviders(providers config.ThirdPartyProviders) []string
- func NewHTTPErrorHandler(config HTTPErrorHandlerConfig) func(err error, c echo.Context)
- func ToHttpError(err error) *echo.HTTPError
- func TransformValidationErrors(err error) []string
- func UseEnterpriseConnection(samlConfig *samlConfig.Saml) bool
- type Account
- type Claims
- type CreateUserResponse
- type CustomValidator
- type EmailCreateRequest
- type EmailJWT
- type EmailResponse
- type EmailUpdateRequest
- type Emails
- type GetUserResponse
- type HTTPErrorHandlerConfig
- type Identities
- type Identity
- type MFAConfig
- type Metadata
- type MetadataJWT
- type PasscodeFinishRequest
- type PasscodeInitRequest
- type PasscodeReturn
- type Password
- type ProfileData
- type PublicConfig
- type SessionData
- type ThirdPartyAuthCallback
- type ThirdPartyAuthRequest
- type UserInfoResponse
- type UserJWT
- type Username
- type ValidateSessionRequest
- type ValidateSessionResponse
- type ValidationErrors
- type WebauthnCredentialResponse
- type WebauthnCredentialUpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnabledProviders ¶
func GetEnabledProviders(providers config.ThirdPartyProviders) []string
func NewHTTPErrorHandler ¶
func NewHTTPErrorHandler(config HTTPErrorHandlerConfig) func(err error, c echo.Context)
func ToHttpError ¶
func UseEnterpriseConnection ¶
func UseEnterpriseConnection(samlConfig *samlConfig.Saml) bool
Types ¶
type Claims ¶
type Claims struct {
Subject uuid.UUID `json:"subject"`
IssuedAt *time.Time `json:"issued_at,omitempty"`
Expiration time.Time `json:"expiration"`
Audience []string `json:"audience,omitempty"`
Issuer *string `json:"issuer,omitempty"`
Email *EmailJWT `json:"email,omitempty"`
Username *string `json:"username,omitempty"`
SessionID uuid.UUID `json:"session_id"`
CustomClaims map[string]interface{} `json:"-"`
}
func (Claims) MarshalJSON ¶
Custom MarshalJSON to flatten CustomClaims into the top level
type CreateUserResponse ¶
type CustomValidator ¶
func NewCustomValidator ¶
func NewCustomValidator() *CustomValidator
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i interface{}) error
type EmailCreateRequest ¶
type EmailCreateRequest struct {
Address string `json:"address"`
}
type EmailJWT ¶
type EmailJWT struct {
Address string `json:"address"`
IsPrimary bool `json:"is_primary"`
IsVerified bool `json:"is_verified"`
}
func EmailJWTFromEmailModel ¶
type EmailResponse ¶
type EmailResponse struct {
ID uuid.UUID `json:"id"`
Address string `json:"address"`
IsVerified bool `json:"is_verified"`
IsPrimary bool `json:"is_primary"`
Identity *Identity `json:"identity,omitempty"` // Deprecated
Identities Identities `json:"identities,omitempty"`
}
func FromEmailModel ¶
func FromEmailModel(email *models.Email, cfg *config.Config) *EmailResponse
FromEmailModel Converts the DB model to a DTO object
type EmailUpdateRequest ¶
type EmailUpdateRequest struct {
IsPrimary *bool `json:"is_primary"`
}
type GetUserResponse ¶
type GetUserResponse struct {
ID uuid.UUID `json:"id"`
Email *string `json:"email,omitempty"`
Username *string `json:"username,omitempty"`
WebauthnCredentials []models.WebauthnCredential `json:"webauthn_credentials"` // deprecated
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Metadata *Metadata `json:"metadata,omitempty"`
ProfileData `json:",inline"`
}
type HTTPErrorHandlerConfig ¶
type Identities ¶
type Identities []Identity
func FromIdentitiesModel ¶
func FromIdentitiesModel(identities models.Identities, cfg *config.Config) Identities
type Metadata ¶
type Metadata struct {
Public json.RawMessage `json:"public_metadata,omitempty"`
Unsafe json.RawMessage `json:"unsafe_metadata,omitempty"`
}
Metadata represents user metadata with public and unsafe fields
func NewMetadata ¶
func NewMetadata(metadata *models.UserMetadata) *Metadata
NewMetadata creates a new Metadata DTO from a UserMetadata model
type MetadataJWT ¶
type MetadataJWT struct {
// contains filtered or unexported fields
}
MetadataJWT represents user metadata with public and unsafe fields. This metadata representation is used for JWT template processing. Fields are private on purpose since the type provides dedicated methods with the same name for accessing the data during template processing.
func MetadataJWTFromUserModel ¶
func MetadataJWTFromUserModel(metadata *models.UserMetadata) *MetadataJWT
MetadataJWTFromUserModel creates a new MetadataJWT DTO from a UserMetadata model
func NewMetadataJWT ¶
func NewMetadataJWT(public, unsafe json.RawMessage) *MetadataJWT
NewMetadataJWT creates a new MetadataJWT from public and unsafe metadata JSON raw messages. Primarily used in tests to construct a MetadataJWT (due to private fields)
func (*MetadataJWT) MarshalJSON ¶
func (m *MetadataJWT) MarshalJSON() ([]byte, error)
func (*MetadataJWT) Public ¶
func (m *MetadataJWT) Public(path ...string) string
func (*MetadataJWT) String ¶
func (m *MetadataJWT) String() string
func (*MetadataJWT) Unsafe ¶
func (m *MetadataJWT) Unsafe(path ...string) string
type PasscodeFinishRequest ¶
type PasscodeInitRequest ¶
type PasscodeReturn ¶
type ProfileData ¶
type ProfileData struct {
UserID uuid.UUID `json:"user_id"`
Passkeys []WebauthnCredentialResponse `json:"passkeys,omitempty"`
SecurityKeys []WebauthnCredentialResponse `json:"security_keys,omitempty"`
MFAConfig MFAConfig `json:"mfa_config"`
Emails []EmailResponse `json:"emails,omitempty"`
Username *Username `json:"username,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata *Metadata `json:"metadata,omitempty"`
}
func ProfileDataFromUserModel ¶
func ProfileDataFromUserModel(user *models.User, cfg *config.Config) *ProfileData
type PublicConfig ¶
type PublicConfig struct {
Password Password `json:"password"`
Emails Emails `json:"emails"`
Providers []string `json:"providers"`
Account Account `json:"account"`
UseEnterpriseConnection bool `json:"use_enterprise"`
}
PublicConfig is the part of the configuration that will be shared with the frontend
func FromConfig ¶
func FromConfig(cfg config.Config) PublicConfig
FromConfig Returns a PublicConfig from the Application configuration
type SessionData ¶
type SessionData struct {
ID uuid.UUID `json:"id"`
UserAgentRaw *string `json:"user_agent_raw,omitempty"`
UserAgent *string `json:"user_agent,omitempty"`
IpAddress *string `json:"ip_address,omitempty"`
Current bool `json:"current"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
LastUsed time.Time `json:"last_used"`
}
func FromSessionModel ¶
func FromSessionModel(model models.Session, current bool) SessionData
type ThirdPartyAuthCallback ¶
type ThirdPartyAuthCallback struct {
AuthCode string `query:"code"`
State string `query:"state" validate:"required"`
Error string `query:"error"`
ErrorDescription string `query:"error_description"`
}
func (ThirdPartyAuthCallback) HasError ¶
func (cb ThirdPartyAuthCallback) HasError() bool
type ThirdPartyAuthRequest ¶
type UserInfoResponse ¶
type UserJWT ¶
type UserJWT struct {
UserID string `json:"user_id"`
Email *EmailJWT `json:"email,omitempty"`
Username string `json:"username"`
Metadata *MetadataJWT `json:"metadata,omitempty"`
}
UserJWT represents an abstracted user model for session management
func UserJWTFromUserModel ¶
type Username ¶
type Username struct {
ID uuid.UUID `json:"id"`
Username string `json:"username"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func FromUsernameModel ¶
type ValidateSessionRequest ¶
type ValidateSessionRequest struct {
SessionToken string `json:"session_token" validate:"required"`
}
type ValidateSessionResponse ¶
type ValidationErrors ¶
type ValidationErrors struct {
Errors []string `json:"errors"`
}
type WebauthnCredentialResponse ¶
type WebauthnCredentialResponse struct {
ID string `json:"id"`
Name *string `json:"name,omitempty"`
PublicKey string `json:"public_key"`
AttestationType string `json:"attestation_type"`
AAGUID uuid.UUID `json:"aaguid"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
Transports []string `json:"transports"`
BackupEligible bool `json:"backup_eligible"`
BackupState bool `json:"backup_state"`
MFAOnly bool `json:"mfa_only"`
}
func FromWebauthnCredentialModel ¶
func FromWebauthnCredentialModel(c *models.WebauthnCredential) *WebauthnCredentialResponse
FromWebauthnCredentialModel Converts the DB model to a DTO object
type WebauthnCredentialUpdateRequest ¶
type WebauthnCredentialUpdateRequest struct {
Name *string `json:"name"`
}