Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrCannotFindValidConfiguration = "err_cannot_find_valid_configuration" ErrCannotRunQuery = "err_cannot_run_query" ErrWrongPassword = "err_wrong_password" ErrUserNotFound = "err_user_not_found" ErrCannotReadUserDocument = "err_cannot_read_user_document" ErrCannotReadUserCredentials = "err_cannot_read_user_credentials" ErrEmailDouble = "err_email_double" ErrUnexpectedError = "err_unexpected_error" ErrMissingEmail = "err_missing_email" ErrMissingPassword = "err_missing_password" ErrEmailTooLong = "err_email_too_long" ErrPasswordTooLong = "err_password_too_long" ErrWrongEmailFormat = "err_wrong_email_format" ErrCannotHashPassword = "err_cannot_hash_password" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication struct { Email string `json:"email"` PasswordHashed string `json:"password_hashed"` }
func (*Authentication) CheckAccess ¶
func (a *Authentication) CheckAccess(ua *UnencryptedAuthentication) *errors.Error
Check if unencrypted credentials match an encrypted user document on the server.
May return:
- ErrWrongPassword
type EncryptConfig ¶
type UnencryptedAuthentication ¶
type UnencryptedAuthentication struct { Email string `json:"email"` Password string `json:"password"` }
func (*UnencryptedAuthentication) Authenticate ¶
func (ua *UnencryptedAuthentication) Authenticate(docPtr interface{}) *errors.Error
Perform user authentication based on unencrypted credentials. On success, return a full user document to the variable pointed by docPtr.
May return:
ErrWrongPassword
ErrUserNotFound
ErrCannotFindValidConfiguration
ErrCannotRunQuery
ErrEmailDouble
ErrCannotReadUserCredentials
ErrCannotReadUserDocument
ErrUnexpectedError
anogo.ErrIsNotPtr
anogo.ErrIsNestedPtr
func (*UnencryptedAuthentication) Encrypt ¶
func (ua *UnencryptedAuthentication) Encrypt(opts *EncryptConfig) (a *Authentication, error2 *errors.Error)
Hash user password and return a document ready to be saved to the database. Used to create and update user account.
May return:
- ErrMissingEmail
- ErrMissingPassword
- ErrPasswordTooLong
- ErrEmailTooLong
- ErrWrongEmailFormat
- ErrCannotHashPassword
Click to show internal directories.
Click to hide internal directories.