auth

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 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 NewJwt added in v1.0.25

func NewJwt(guard string) auth.Auth

func NewSession added in v1.0.25

func NewSession(guard string) auth.Auth

Types

type Application

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

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 Jwt added in v1.0.25

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

func (*Jwt) Guard added in v1.0.46

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

func (*Jwt) Login added in v1.0.25

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

func (*Jwt) LoginUsingID added in v1.0.25

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

func (*Jwt) Logout added in v1.0.25

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

func (*Jwt) Parse added in v1.0.25

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

func (*Jwt) Refresh added in v1.0.25

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

Refresh need parse token first.

func (*Jwt) User added in v1.0.25

func (app *Jwt) User(ctx *frame.Context, user auth.User) error

User need parse token first.

type ServiceProvider

type ServiceProvider struct {
	Auth   auth.Auth
	Config session.Config
}

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

func (*Session) Login added in v1.0.25

func (app *Session) Login(ctx *frame.Context, user auth.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 auth.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