Documentation ¶
Index ¶
- Variables
- type NativeScheme
- func (s NativeScheme) AppLogin(appName string) (auth.Token, error)
- func (s NativeScheme) AppLogout(token string) error
- func (s NativeScheme) Auth(token string) (auth.Token, error)
- func (s NativeScheme) ChangePassword(token auth.Token, oldPassword string, newPassword string) error
- func (s NativeScheme) Create(user *auth.User) (*auth.User, error)
- func (s NativeScheme) Info() (auth.SchemeInfo, error)
- func (s NativeScheme) Login(params map[string]string) (auth.Token, error)
- func (s NativeScheme) Logout(token string) error
- func (s NativeScheme) Name() string
- func (s NativeScheme) Remove(u *auth.User) error
- func (s NativeScheme) ResetPassword(user *auth.User, resetToken string) error
- func (s NativeScheme) StartPasswordReset(user *auth.User) error
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingPasswordError = &errors.ValidationError{Message: "you must provide a password to login"} ErrMissingEmailError = &errors.ValidationError{Message: "you must provide a email to login"} ErrInvalidEmail = &errors.ValidationError{Message: "invalid email"} ErrInvalidPassword = &errors.ValidationError{Message: "password length should be least 6 characters and at most 50 characters"} ErrEmailRegistered = &errors.ConflictError{Message: "this email is already registered"} ErrPasswordMismatch = &errors.NotAuthorizedError{Message: "the given password didn't match the user's current password"} )
Functions ¶
This section is empty.
Types ¶
type NativeScheme ¶
type NativeScheme struct{}
func (NativeScheme) AppLogout ¶
func (s NativeScheme) AppLogout(token string) error
func (NativeScheme) ChangePassword ¶
func (NativeScheme) Info ¶
func (s NativeScheme) Info() (auth.SchemeInfo, error)
func (NativeScheme) Logout ¶
func (s NativeScheme) Logout(token string) error
func (NativeScheme) Name ¶
func (s NativeScheme) Name() string
func (NativeScheme) ResetPassword ¶
func (s NativeScheme) ResetPassword(user *auth.User, resetToken string) error
ResetPassword actually resets the password of the user. It needs the token string. The new password will be a random string, that will be then sent to the user email.
func (NativeScheme) StartPasswordReset ¶
func (s NativeScheme) StartPasswordReset(user *auth.User) error
type Token ¶
type Token struct { Token string `json:"token"` Creation time.Time `json:"creation"` Expires time.Duration `json:"expires"` UserEmail string `json:"email"` AppName string `json:"app"` }
func (*Token) GetAppName ¶
func (*Token) GetUserName ¶
func (*Token) IsAppToken ¶
func (*Token) Permissions ¶
func (t *Token) Permissions() ([]permission.Permission, error)
Click to show internal directories.
Click to hide internal directories.