Documentation ¶
Index ¶
- Variables
- type NativeScheme
- func (s NativeScheme) Auth(ctx context.Context, token string) (auth.Token, error)
- func (s NativeScheme) ChangePassword(ctx context.Context, token auth.Token, oldPassword string, newPassword string) error
- func (s NativeScheme) Create(ctx context.Context, user *auth.User) (*auth.User, error)
- func (s NativeScheme) Info(ctx context.Context) (*authTypes.SchemeInfo, error)
- func (s NativeScheme) Login(ctx context.Context, params map[string]string) (auth.Token, error)
- func (s NativeScheme) Logout(ctx context.Context, token string) error
- func (s NativeScheme) Remove(ctx context.Context, u *auth.User) error
- func (s NativeScheme) ResetPassword(ctx context.Context, user *auth.User, resetToken string) error
- func (s NativeScheme) StartPasswordReset(ctx context.Context, 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) ChangePassword ¶
func (NativeScheme) Info ¶
func (s NativeScheme) Info(ctx context.Context) (*authTypes.SchemeInfo, error)
func (NativeScheme) ResetPassword ¶
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 ¶
type Token ¶
type Token struct { Token string `json:"token"` Creation time.Time `json:"creation"` Expires time.Duration `json:"expires"` UserEmail string `json:"email"` }
func (*Token) GetUserName ¶
func (*Token) Permissions ¶
func (t *Token) Permissions() ([]permission.Permission, error)
Click to show internal directories.
Click to hide internal directories.