Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthEvent ¶
type AuthEvent struct { ID string `db:"event_id"` UserID string `db:"user_id"` Event string `db:"event"` Timestamp int64 `db:"event_timestamp"` IPV4 string `db:"ip_v4"` IPV6 string `db:"ip_v6"` Agent string `db:"agent"` }
func NewAuthEvent ¶
type Category ¶
type Category int
Category is the most significant digit of the error code.
const ( // Success indicates no error occurred. Success Category = 1000 * iota // 0XXX // DatabaseError indicates a fault in database operation. DatabaseError // 1XXX SecurityError // 2XXX JSONAPISpecError // 3XXX AuthenticationError // 4xxx ServerError // 5xxx TOTPError // 6xxx WebauthnError // 7xxx )
type Error ¶
type Error struct { // error code for machine ErrorCode int `json:"code"` // message to display for end user Message string `json:"message"` Err error `json:"-"` }
This is JWT Auth Token
swagger:model AuthError
type JSONAPIError ¶
type JSONAPIError struct {
Meta *Error `json:"meta,omitempty"`
}
type JSONAPIErrors ¶
type JSONAPIErrors struct {
Errors []JSONAPIError `json:"errors"`
}
type JSONAPIUserSignup ¶
type JSONAPIUserSignup struct { // json:api data property // // required: true Data struct { // json:api attributes property // // required: true Attributes User `json:"attributes"` // json:api type property // // required: true // example: users Type string `json:"type"` } `json:"data"` // json:api jsonapi property // // required: true Jsonapi struct { // json:api version property // // required: true // example: 1.0 Version string `json:"version"` } `json:"jsonapi"` }
JSONAPIUserSignup represents the user signup for this application
Refer to JSON:API specification at https://jsonapi.org/
swagger:model JSONAPIUserSignup
type JSONAPIUserSignupResponse ¶
type JSONAPIUserSignupResponse struct { // json:api data property // // required: true // read-only: true Data struct { // json:api attributes property // // required: true // read-only: true Attributes User `json:"attributes"` // json:api id property // // required: true // read-only: true // example: a2aee5e6-05a0-438c-9276-4ba406b7bf9e ID string `json:"id"` // json:api links property // // required: true // read-only: true Links struct { // json:api self property // // required: true // read-only: true // example: /users/a2aee5e6-05a0-438c-9276-4ba406b7bf9e Self string `json:"self"` } `json:"links"` // json:api type property // // required: true // read-only: true // example: users Type string `json:"type"` } `json:"data"` // json:api jsonapi property // // required: true // read-only: true Jsonapi struct { // json:api version property // // required: true // read-only: true // example: 1.0 Version string `json:"version"` } `json:"jsonapi"` // json:api links property // // required: true // read-only: true Links struct { // json:api links self property // // required: true // read-only: true // example: /users/a2aee5e6-05a0-438c-9276-4ba406b7bf9e Self string `json:"self"` } `json:"links"` }
JSONAPIUserSignupResponse represents the user for this application
Refer to JSON:API specification at https://jsonapi.org/
swagger:model JSONAPIUserSignupResponse
type MissingDataError ¶
type MissingDataError struct { Error // token sent after successful password signin // example: MzM4OGNkMWEtNmQyNC00MDQ1LWJmYzctMWJlMzM3ZTk1NDQ5 SigninSessionToken string `json:"signin_session_token"` }
This is JWT Auth Token
swagger:model MissingDataError
type Reason ¶
type Reason int
Reason is the last 3 digits of the error code.
const ( // QueryingFailed indicates general database error during SQL execution QueryingFailed Reason = 100 * (iota + 1) //11XX PersistingFailed Unknown GeneralError DeletingFailed )
DatabaseError reasons
const ( // QueryingFailed indicates general database error during SQL execution ContextUserDoesNotMatchGivenUserID Reason = 100 * (iota + 1) //21XX UserNotFoundFromContext MissingAuthorizationHeader InternalError ValidatingAuthTokenError )
SecurityError reasons
const ( // Marshalling indicates general database error during SQL execution Marshalling Reason = 100 * (iota + 1) //31XX Unmarshalling )
JSONAPISpecError reasons
const ( // SessionTokenDecodingFailed indicates base64 decoding failure SigninSessionTokenDecodingFailed Reason = 100 * (iota + 1) //41XX SigninSessionExpired UsernameOrPasswordDoesNotMatch WebauthnAuthFailure TOTPAuthFailure UserUnknown JWTEncodingFailure TOTPRequired WebAuthnRequired WebauthnRegistrationFailure ClientNotFound OAuth2NonceUsedAlready ValidatingClientFailed AuthorizationRequestRecordNotFound )
AuthenticationError reasons
ServerError reasons
Webauthn reasons
type User ¶
type User struct { // the id for this user // // required: true // read-only: true // example: a2aee5e6-05a0-438c-9276-4ba406b7bf9e ID string `json:"id" db:"user_id" api:"users"` PlatformName string `json:"-" db:"platform_name"` // email // // required: true // example: john.smith@example.com Email string `json:"email" db:"email" api:"attr"` // password // // required: true // example: pass1234 Password string `json:"password" db:"passhash" api:"attr"` // first name // // required: true // example: John FirstName string `json:"firstname" db:"firstname" api:"attr"` // last name // // required: true // example: Smith LastName string `json:"lastname" db:"lastname" api:"attr"` // created date in unix time // // read-only: true // example: 1596747095 Created int64 `json:"created" db:"created_date" api:"attr"` // totp enabled or not // // example: false TOTPEnabled bool `json:"totpenabled" db:"totp_enabled" api:"attr"` TOTPSecretCurrent string `json:"-" db:"totp_secret_current"` TOTPSecretTmp string `json:"-" db:"totp_secret_tmp"` TOTPSecretTmpExp int64 `json:"-" db:"totp_secret_tmp_exp"` // webauthn enabled or not // // example: false WebAuthnEnabled bool `json:"webauthnenabled" db:"webauthn_enabled" api:"attr"` WebAuthnSessionData string `json:"-" db:"webauthn_session"` JWTSecret string `json:"-" db:"jwt_secret"` Credentials []webauthn.Credential `json:"-"` }
swagger:model User
func (User) AddCredential ¶
func (u User) AddCredential(credential webauthn.Credential)
func (User) WebAuthnCredentials ¶
func (u User) WebAuthnCredentials() []webauthn.Credential
func (User) WebAuthnDisplayName ¶
func (User) WebAuthnID ¶
func (User) WebAuthnIcon ¶
func (User) WebAuthnName ¶
type UserCredential ¶
type UserCredential struct { ID string `db:"credential_id"` UserID string `db:"user_id"` Credential string `db:"credential"` }
func NewUserCredential ¶
func NewUserCredential(userID, credential string) UserCredential
type UserProfile ¶
type UserProfile struct { // the id for this user // // read-only: true // example: a2aee5e6-05a0-438c-9276-4ba406b7bf9e ID string `json:"id" db:"user_id" api:"users"` // the email // // read-only: true // example: john.smith@example.com Email string `json:"email" db:"email" api:"attr"` // the first name // // read-only: true // example: John FirstName string `json:"firstname" db:"firstname" api:"attr"` // the last name // // read-only: true // example: Smith LastName string `json:"lastname" db:"lastname" api:"attr"` }
UserProfile represents the user for this application
A user profile is very narrow representation of user ¶
swagger:model UserProfile