native

package
v0.0.0-...-47649f3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 23 Imported by: 4

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

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

func (NativeScheme) ChangePassword

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

func (NativeScheme) Create

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

func (NativeScheme) Info

func (NativeScheme) Login

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

func (NativeScheme) Logout

func (s NativeScheme) Logout(ctx context.Context, token string) error

func (NativeScheme) Remove

func (s NativeScheme) Remove(ctx context.Context, u *auth.User) error

func (NativeScheme) ResetPassword

func (s NativeScheme) ResetPassword(ctx context.Context, 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(ctx context.Context, 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"`
}

func (*Token) Engine

func (t *Token) Engine() string

func (*Token) GetUserName

func (t *Token) GetUserName() string

func (*Token) GetValue

func (t *Token) GetValue() string

func (*Token) Permissions

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

func (*Token) User

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

Jump to

Keyboard shortcuts

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