auth

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthManager

type AuthManager struct {
	App contracts.IApplication
	// contains filtered or unexported fields
}

func (*AuthManager) Guard

func (a *AuthManager) Guard(guard ...string) contracts.IAuth

设置守卫

type AuthServiceProvider

type AuthServiceProvider struct {
	*support.ServiceProvider
}

func (*AuthServiceProvider) Register

func (a *AuthServiceProvider) Register()

type CustomCliams

type CustomCliams struct {
	User *GenericUser
	*jwt.RegisteredClaims
}

type DatabaseUserProvider

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

func (*DatabaseUserProvider) RetrieveByCredentials

func (d *DatabaseUserProvider) RetrieveByCredentials(credentials map[string]interface{}) contracts.IUser

通过凭证检索

func (*DatabaseUserProvider) RetrieveById

func (d *DatabaseUserProvider) RetrieveById(identifier string) contracts.IUser

func (*DatabaseUserProvider) RetrieveByToken

func (d *DatabaseUserProvider) RetrieveByToken(identifier, token string) contracts.IUser

func (*DatabaseUserProvider) UpdateApiToken

func (d *DatabaseUserProvider) UpdateApiToken(user contracts.IUser, token string)

func (*DatabaseUserProvider) UpdateRememberToken

func (d *DatabaseUserProvider) UpdateRememberToken(user contracts.IUser, token string)

func (*DatabaseUserProvider) ValidateCredentials

func (d *DatabaseUserProvider) ValidateCredentials(user contracts.IUser, credentials map[string]interface{}) bool

type GenericUser

type GenericUser struct {
	Attributes map[string]interface{}
}

func (*GenericUser) Get

func (g *GenericUser) Get(name string) interface{}

func (*GenericUser) GetApiToken

func (g *GenericUser) GetApiToken() string

func (*GenericUser) GetApiTokenName

func (g *GenericUser) GetApiTokenName() string

func (*GenericUser) GetAuthIdentifier

func (g *GenericUser) GetAuthIdentifier() string

func (*GenericUser) GetAuthIdentifierName

func (g *GenericUser) GetAuthIdentifierName() string

func (*GenericUser) GetAuthPassword

func (g *GenericUser) GetAuthPassword() string

func (*GenericUser) GetRememberToken

func (g *GenericUser) GetRememberToken() string

func (*GenericUser) GetRememberTokenName

func (g *GenericUser) GetRememberTokenName() string

func (*GenericUser) IsEmpty

func (g *GenericUser) IsEmpty() bool

func (*GenericUser) SetApiToken

func (g *GenericUser) SetApiToken(v interface{})

func (*GenericUser) SetRememberToken

func (g *GenericUser) SetRememberToken(v interface{})

type JWTGuard

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

func (*JWTGuard) Attempt

func (j *JWTGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool

func (*JWTGuard) Check

func (j *JWTGuard) Check() bool

func (*JWTGuard) Guest

func (j *JWTGuard) Guest() bool

func (*JWTGuard) ID

func (j *JWTGuard) ID() string

func (*JWTGuard) Login

func (j *JWTGuard) Login(user contracts.IUser, remember ...bool)

func (*JWTGuard) Logout

func (j *JWTGuard) Logout()

func (*JWTGuard) SetUser

func (j *JWTGuard) SetUser(user contracts.IUser)

func (*JWTGuard) User

func (j *JWTGuard) User() contracts.IUser

func (*JWTGuard) Validate

func (j *JWTGuard) Validate(credentials map[string]interface{}) bool

func (*JWTGuard) WithContext

func (j *JWTGuard) WithContext(c *gin.Context) contracts.IAuth

type SessionGuard

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

func (*SessionGuard) Attempt

func (a *SessionGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool

尝试登录

func (*SessionGuard) Check

func (a *SessionGuard) Check() bool

func (*SessionGuard) Guest

func (a *SessionGuard) Guest() bool

func (*SessionGuard) ID

func (a *SessionGuard) ID() string

func (*SessionGuard) Login

func (a *SessionGuard) Login(user contracts.IUser, remember ...bool)

使用IUser登录

func (*SessionGuard) Logout

func (a *SessionGuard) Logout()

func (*SessionGuard) SetUser

func (a *SessionGuard) SetUser(user contracts.IUser)

func (*SessionGuard) User

func (a *SessionGuard) User() contracts.IUser

func (*SessionGuard) Validate

func (a *SessionGuard) Validate(credentials map[string]interface{}) bool

func (*SessionGuard) WithContext

func (a *SessionGuard) WithContext(c *gin.Context) contracts.IAuth

session, cookie 会用到context

type TokenGuard

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

func (*TokenGuard) Attempt

func (t *TokenGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool

func (*TokenGuard) Check

func (t *TokenGuard) Check() bool

func (*TokenGuard) Guest

func (t *TokenGuard) Guest() bool

func (*TokenGuard) ID

func (t *TokenGuard) ID() string

func (*TokenGuard) Login

func (t *TokenGuard) Login(user contracts.IUser, remember ...bool)

func (*TokenGuard) Logout

func (t *TokenGuard) Logout()

func (*TokenGuard) SetUser

func (t *TokenGuard) SetUser(user contracts.IUser)

func (*TokenGuard) User

func (t *TokenGuard) User() contracts.IUser

func (*TokenGuard) Validate

func (t *TokenGuard) Validate(credentials map[string]interface{}) bool

func (*TokenGuard) WithContext

func (t *TokenGuard) WithContext(c *gin.Context) contracts.IAuth

Jump to

Keyboard shortcuts

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