auth

package
v0.0.0-...-d1a64ea Latest Latest
Warning

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

Go to latest
Published: May 22, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationHeader = "Authorization"
	AuthorizationScheme = "GOST-TOKEN"
)

The keys that are used in the request header to authorize the user

Variables

View Source
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

View Source
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

func ActivateAppUser(token string) error

ActivateAppUser activates an application user based on its token

func Authorize

func Authorize(httpHeader http.Header) (*identity.Identity, error)

Authorize tries to authorize an existing parkme-apiToken

func ChangePassword

func ChangePassword(userEmail, oldPassword, password string) error

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

func RequestResetPassword(emailAddress, passwordResetServiceLink string) error

RequestResetPassword generates a reset token and sends an email with the link where to perform the change

func ResendAccountActivationEmail

func ResendAccountActivationEmail(emailAddress, activationServiceLink string) error

ResendAccountActivationEmail resends the email with the details for activating their user account

func ResetPassword

func ResetPassword(token, password string) error

ResetPassword resets the password of an application user

Types

This section is empty.

Directories

Path Synopsis
Package cookies uses the DatabaseCookieStore type as its default cookie store for managing user sessions
Package cookies uses the DatabaseCookieStore type as its default cookie store for managing user sessions

Jump to

Keyboard shortcuts

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