native

package
v0.0.0-...-1b7c243 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2017 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

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) AppLogin

func (s NativeScheme) AppLogin(appName string) (auth.Token, error)

func (NativeScheme) AppLogout

func (s NativeScheme) AppLogout(token string) error

func (NativeScheme) Auth

func (s NativeScheme) Auth(token string) (auth.Token, error)

func (NativeScheme) ChangePassword

func (s NativeScheme) ChangePassword(token auth.Token, oldPassword string, newPassword string) error

func (NativeScheme) Create

func (s NativeScheme) Create(user *auth.User) (*auth.User, error)

func (NativeScheme) Info

func (s NativeScheme) Info() (auth.SchemeInfo, error)

func (NativeScheme) Login

func (s NativeScheme) Login(params map[string]string) (auth.Token, error)

func (NativeScheme) Logout

func (s NativeScheme) Logout(token string) error

func (NativeScheme) Name

func (s NativeScheme) Name() string

func (NativeScheme) Remove

func (s NativeScheme) Remove(u *auth.User) error

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 (t *Token) GetAppName() string

func (*Token) GetUserName

func (t *Token) GetUserName() string

func (*Token) GetValue

func (t *Token) GetValue() string

func (*Token) IsAppToken

func (t *Token) IsAppToken() bool

func (*Token) Permissions

func (t *Token) Permissions() ([]permission.Permission, error)

func (*Token) User

func (t *Token) User() (*auth.User, error)

Jump to

Keyboard shortcuts

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