auth

package
v1.13.6 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 18 Imported by: 5

Documentation

Index

Constants

View Source
const BindingAuth = "goravel.auth"
View Source
const BindingGate = "goravel.gate"

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")
	ErrorInvalidKey          = errors.New("invalid key")
)

Functions

This section is empty.

Types

type Auth added in v1.2.0

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

func NewAuth added in v1.6.0

func NewAuth(guard string, cache cache.Cache, config config.Config, orm orm.Orm) *Auth

func (*Auth) Guard added in v1.6.0

func (a *Auth) Guard(name string) contractsauth.Auth

func (*Auth) Login added in v1.6.0

func (a *Auth) Login(ctx http.Context, user any) (token string, err error)

func (*Auth) LoginUsingID added in v1.6.0

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

func (*Auth) Logout added in v1.6.0

func (a *Auth) Logout(ctx http.Context) error

func (*Auth) Parse added in v1.6.0

func (a *Auth) Parse(ctx http.Context, token string) (*contractsauth.Payload, error)

func (*Auth) Refresh added in v1.6.0

func (a *Auth) Refresh(ctx http.Context) (token string, err error)

Refresh need parse token first.

func (*Auth) User added in v1.6.0

func (a *Auth) User(ctx http.Context, user any) error

User need parse token first.

type Claims

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

type Guard added in v1.2.0

type Guard struct {
	Claims *Claims
	Token  string
}

type Guards added in v1.6.0

type Guards map[string]*Guard

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (database *ServiceProvider) Register(app foundation.Application)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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