auth

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 10 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorRefreshTimeExceeded = errors.New("refresh time exceeded")
	ErrorTokenExpired        = errors.New("token expired")
	ErrorNoPrimaryKeyField   = errors.New("the primaryKey field was not found in the model, set primaryKey like orm.Model")
	ErrorEmptySecret         = errors.New("secret is required")
	ErrorTokenDisabled       = errors.New("token is disabled")
)

Functions

func NewApplication

func NewApplication(guard string) auth.Auth

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

func (*Application) Guard

func (app *Application) Guard(name string) auth.Auth

func (*Application) Login

func (app *Application) Login(user any) (token string, err error)

func (*Application) LoginUsingID

func (app *Application) LoginUsingID(id any) (token string, err error)

func (*Application) Logout

func (app *Application) Logout() error

func (*Application) Parse

func (app *Application) Parse(token string) error

func (*Application) Refresh

func (app *Application) Refresh() (token string, err error)

Refresh need parse token first.

func (*Application) User

func (app *Application) User(user any) error

User need parse token first.

type Claims

type Claims struct {
	Key any `json:"key"`
	jwt.RegisteredClaims
}

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (database *ServiceProvider) Register()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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