auth

package
v1.15.8 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: MIT Imports: 20 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorRefreshTimeExceeded = errors.AuthRefreshTimeExceeded
	ErrorTokenExpired        = errors.AuthTokenExpired
	ErrorNoPrimaryKeyField   = errors.AuthNoPrimaryKeyField
	ErrorEmptySecret         = errors.AuthEmptySecret
	ErrorTokenDisabled       = errors.AuthTokenDisabled
	ErrorParseTokenFirst     = errors.AuthParseTokenFirst
	ErrorInvalidClaims       = errors.AuthInvalidClaims
	ErrorInvalidToken        = errors.AuthInvalidToken
	ErrorInvalidKey          = errors.AuthInvalidKey
)

These errors may be used by user's project, so we can't remove them.

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, ctx http.Context, orm orm.Orm) *Auth

func (*Auth) Guard added in v1.6.0

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

func (*Auth) ID added in v1.15.0

func (a *Auth) ID() (string, error)

func (*Auth) Login added in v1.6.0

func (a *Auth) Login(user any) (token string, err error)

func (*Auth) LoginUsingID added in v1.6.0

func (a *Auth) LoginUsingID(id any) (token string, err error)

func (*Auth) Logout added in v1.6.0

func (a *Auth) Logout() error

func (*Auth) Parse added in v1.6.0

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

func (*Auth) Refresh added in v1.6.0

func (a *Auth) Refresh() (token string, err error)

Refresh need parse token first.

func (*Auth) User added in v1.6.0

func (a *Auth) User(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 (auth *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (auth *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