user

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Email    string `json:"email,omitempty" xml:"Email,omitempty"`
	Password string `json:"password,omitempty" xml:"Password,omitempty"`
	Token    string `json:"token,omitempty" xml:"Token,omitempty"`
	Refresh  string `json:"refresh,omitempty" xml:"Refresh,omitempty"`
}

Auth is a user model.

func (*Auth) Login

func (a *Auth) Login(config *config.Config, registry map[string]string) (err error)

Login with email and password.

func (*Auth) RefreshToken

func (a *Auth) RefreshToken() error

RefreshToken returns new token and refresh tokens.

type Controller

type Controller struct {
	// inherit BaseController functionality (related to middleware)
	*mw.BaseController
	// controller dependencies
	Config *config.Config    `inject:"t"`
	Users  map[string]string `inject:"t"`
}

Controller is responsible for user AUTH operations.

func (*Controller) Init

func (c *Controller) Init() error

Init user controller (TODO: add middleware for available methods).

func (*Controller) PatchAll

func (c *Controller) PatchAll(_ context.Context, _ url.Values, cf func(interface{}) error) (interface{}, error)

PatchAll handles user token refresh request.

func (*Controller) PostAll

func (c *Controller) PostAll(_ context.Context, cf func(interface{}) error) (interface{}, error)

PostAll handles user login request.

Jump to

Keyboard shortcuts

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