auth

package
v1.0.45 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 17 Imported by: 0

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")
	ErrorParseTokenFirst     = errors.New("parse token first")
	ErrorInvalidClaims       = errors.New("invalid claims")
	ErrorInvalidToken        = errors.New("invalid token")
)
View Source
var Drivers *drivers

Functions

func GetAuth added in v1.0.25

func GetAuth(guard string) auth.Auth

func Logout added in v1.0.26

func Logout(ctx *frame.Context)

func NewAuth added in v1.0.31

func NewAuth(guard string) contractauth.Auth

func NewSession added in v1.0.25

func NewSession(guard string) contractauth.Auth

Types

type Application

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

type Auth added in v1.0.12

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

func (*Auth) Guard added in v1.0.31

func (app *Auth) Guard(name string) contractauth.Auth

func (*Auth) Login added in v1.0.31

func (app *Auth) Login(ctx *frame.Context, user contractauth.User) (token string, err error)

func (*Auth) LoginUsingID added in v1.0.31

func (app *Auth) LoginUsingID(ctx *frame.Context, id any) (token string, err error)

func (*Auth) Logout added in v1.0.31

func (app *Auth) Logout(ctx *frame.Context) error

func (*Auth) Parse added in v1.0.31

func (app *Auth) Parse(ctx *frame.Context, token string) error

func (*Auth) Refresh added in v1.0.31

func (app *Auth) Refresh(ctx *frame.Context) (token string, err error)

Refresh need parse token first.

func (*Auth) User added in v1.0.31

func (app *Auth) User(ctx *frame.Context, user contractauth.User) error

User need parse token first.

type Claims

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

type Guard added in v1.0.12

type Guard struct {
	Claims *Claims
	Token  string
}

type Guards added in v1.0.31

type Guards map[string]*Guard

type ServiceProvider

type ServiceProvider struct {
	Auth auth.Auth
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (database *ServiceProvider) Register()

type Session added in v1.0.25

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

func (*Session) Guard added in v1.0.31

func (app *Session) Guard(name string) contractauth.Auth

func (*Session) Login added in v1.0.25

func (app *Session) Login(ctx *frame.Context, user contractauth.User) (token string, err error)

func (*Session) LoginUsingID added in v1.0.25

func (app *Session) LoginUsingID(ctx *frame.Context, id any) (token string, err error)

func (*Session) Logout added in v1.0.25

func (app *Session) Logout(ctx *frame.Context) error

func (*Session) Parse added in v1.0.25

func (app *Session) Parse(ctx *frame.Context, token string) error

func (*Session) Refresh added in v1.0.25

func (app *Session) Refresh(ctx *frame.Context) (token string, err error)

Refresh need parse token first.

func (*Session) User added in v1.0.25

func (app *Session) User(ctx *frame.Context, user contractauth.User) error

User need parse token first.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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