auth

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 13 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")
)

Functions

func GetAuth added in v1.0.25

func GetAuth(guard string) auth.Auth

func NewJwt added in v1.0.25

func NewJwt(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 map[string]*Guard

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

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

func (*Jwt) Login added in v1.0.25

func (app *Jwt) Login(ctx *frame.Context, user contractauth.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 contractauth.User) error

User need parse token first.

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