Documentation ¶
Index ¶
- Constants
- Variables
- func ActivateAppUser(token string) error
- func Authorize(httpHeader http.Header) (*identity.Identity, error)
- func ChangePassword(userEmail, oldPassword, password string) error
- func CreateAppUser(emailAddress, password string, accountType int, activationServiceLink string) (*identity.ApplicationUser, error)
- func GenerateUserAuth(userID bson.ObjectId, password string, clientDetails *cookies.Client) (string, error)
- func RequestResetPassword(emailAddress, passwordResetServiceLink string) error
- func ResendAccountActivationEmail(emailAddress, activationServiceLink string) error
- func ResetPassword(token, password string) error
Constants ¶
const ( AuthorizationHeader = "Authorization" AuthorizationScheme = "GOST-TOKEN" )
The keys that are used in the request header to authorize the user
Variables ¶
var ( ErrInvalidScheme = errors.New("The used authorization scheme is invalid or not supported") ErrInvalidGhostToken = errors.New("The given token is expired or invalid") ErrInvalidUser = errors.New("There is no application user with the given ID") ErrDeactivatedUser = errors.New("The current user account is deactivated or inexistent") ErrInexistentClientDetails = errors.New("Missing client details. Cannot create authorization for anonymous client") ErrPasswordMismatch = errors.New("The entered password is incorrect") )
Errors generated by the auth package
var ( ErrActivationTokenExpired = errors.New("The activation token has expired") ErrResetPasswordTokenExpired = errors.New("The reset password token has expired") ErrAccountAlreadyActivated = errors.New("The account is already activated") )
Errors that can occur during ApplicationUser management
Functions ¶
func ActivateAppUser ¶
ActivateAppUser activates an application user based on its token
func ChangePassword ¶
ChangePassword changes the current password that the user has
func CreateAppUser ¶
func CreateAppUser(emailAddress, password string, accountType int, activationServiceLink string) (*identity.ApplicationUser, error)
CreateAppUser creates a new ApplicationUser with the given data, generates an activation token and sends an email containing a link used for activating the account
func GenerateUserAuth ¶
func GenerateUserAuth(userID bson.ObjectId, password string, clientDetails *cookies.Client) (string, error)
GenerateUserAuth generates a new parkme-api-token, saves it in the database and returns it to the client
func RequestResetPassword ¶
RequestResetPassword generates a reset token and sends an email with the link where to perform the change
func ResendAccountActivationEmail ¶
ResendAccountActivationEmail resends the email with the details for activating their user account
func ResetPassword ¶
ResetPassword resets the password of an application user
Types ¶
This section is empty.