isauth

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

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

Check if unencrypted credentials match an encrypted user document on the server.

May return:

  • ErrWrongPassword

type EncryptConfig

type EncryptConfig struct {
	MaxPasswordLength int
	MaxEmailLength    int
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL