auth

package
v1.1.20 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorRefreshTimeExceeded = errors.New("refresh time exceeded")
	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")
)
View Source
var Drivers *drivers

Functions

func GetAuth

func GetAuth(guard string) auth.Auth

func Logout

func Logout(ctx *frame.Context)

func NewJwt

func NewJwt(guard string) authContract.Auth

func NewSession

func NewSession(guard string, store *session.Store) auth.Auth

Types

type Application

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

type Jwt

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

func (*Jwt) Data added in v1.0.84

func (app *Jwt) Data(ctx *frame.Context) (map[string]any, error)

func (*Jwt) Guard

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

func (*Jwt) Login

func (app *Jwt) Login(ctx *frame.Context, user authContract.User, data ...map[string]any) (token *authContract.AccessToken, err error)

func (*Jwt) LoginUsingID

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

func (*Jwt) Logout

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

func (*Jwt) Parse

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

func (*Jwt) Refresh

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

Refresh need parse token first.

func (*Jwt) User

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

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

func (*Session) Data added in v1.0.84

func (app *Session) Data(ctx *frame.Context) (map[string]any, error)

func (*Session) Guard

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

func (*Session) Login

func (app *Session) Login(ctx *frame.Context, user auth.User, data ...map[string]any) (token *auth.AccessToken, err error)

func (*Session) LoginUsingID

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

func (*Session) Logout

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

func (*Session) Parse

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

func (*Session) Refresh

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

Refresh need parse token first.

func (*Session) User

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