Documentation
¶
Index ¶
- Variables
- func NewJwtGuard(ctx http.Context, name string, userProvider contractsauth.UserProvider) (contractsauth.GuardDriver, error)
- func NewOrmUserProvider(ctx http.Context) (contractsauth.UserProvider, error)
- func NewSessionGuard(ctx http.Context, name string, userProvider contractsauth.UserProvider) (contractsauth.GuardDriver, error)
- type Auth
- type Claims
- type Guards
- type JwtGuard
- func (r *JwtGuard) Check() bool
- func (r *JwtGuard) GetJwtToken() (*JwtToken, error)
- func (r *JwtGuard) Guest() bool
- func (r *JwtGuard) ID() (string, error)
- func (r *JwtGuard) Login(user any) (token string, err error)
- func (r *JwtGuard) LoginUsingID(id any) (token string, err error)
- func (r *JwtGuard) Logout() error
- func (r *JwtGuard) Parse(token string) (*contractsauth.Payload, error)
- func (r *JwtGuard) Refresh() (token string, err error)
- func (r *JwtGuard) User(user any) error
- type JwtToken
- type OrmUserProvider
- type ServiceProvider
- type SessionGuard
- func (r *SessionGuard) Check() bool
- func (r *SessionGuard) Guest() bool
- func (r *SessionGuard) ID() (token string, err error)
- func (r *SessionGuard) Login(user any) (token string, err error)
- func (r *SessionGuard) LoginUsingID(id any) (token string, err error)
- func (r *SessionGuard) Logout() error
- func (r *SessionGuard) Parse(token string) (*contractsauth.Payload, error)
- func (r *SessionGuard) Refresh() (token string, err error)
- func (r *SessionGuard) User(user any) error
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 ErrorUnsupportedDriverMethod = errors.AuthUnsupportedDriverMethod )
These errors may be used by user's project, so we can't remove them.
Functions ¶
func NewJwtGuard ¶ added in v1.15.12
func NewJwtGuard(ctx http.Context, name string, userProvider contractsauth.UserProvider) (contractsauth.GuardDriver, error)
func NewOrmUserProvider ¶ added in v1.15.12
func NewOrmUserProvider(ctx http.Context) (contractsauth.UserProvider, error)
func NewSessionGuard ¶ added in v1.15.12
func NewSessionGuard(ctx http.Context, name string, userProvider contractsauth.UserProvider) (contractsauth.GuardDriver, error)
Types ¶
type Auth ¶ added in v1.2.0
type Auth struct {
contractsauth.GuardDriver
// contains filtered or unexported fields
}
func (*Auth) Extend ¶ added in v1.15.12
func (r *Auth) Extend(name string, fn contractsauth.GuardFunc)
func (*Auth) Guard ¶ added in v1.6.0
func (r *Auth) Guard(name string) contractsauth.GuardDriver
func (*Auth) Provider ¶ added in v1.15.12
func (r *Auth) Provider(name string, fn contractsauth.UserProviderFunc)
type Claims ¶
type Claims struct {
Key string `json:"key"`
jwt.RegisteredClaims
}
type JwtGuard ¶ added in v1.15.12
type JwtGuard struct {
// contains filtered or unexported fields
}
func (*JwtGuard) GetJwtToken ¶ added in v1.15.12
func (*JwtGuard) LoginUsingID ¶ added in v1.15.12
func (*JwtGuard) Parse ¶ added in v1.15.12
func (r *JwtGuard) Parse(token string) (*contractsauth.Payload, error)
type OrmUserProvider ¶ added in v1.15.12
type OrmUserProvider struct {
// contains filtered or unexported fields
}
func (*OrmUserProvider) GetID ¶ added in v1.15.12
func (r *OrmUserProvider) GetID(user any) (any, error)
GetID implements auth.UserProvider.
func (*OrmUserProvider) RetriveByID ¶ added in v1.15.12
func (r *OrmUserProvider) RetriveByID(user any, id any) error
RetriveByID implements auth.UserProvider.
type ServiceProvider ¶
type ServiceProvider struct {
}
func (*ServiceProvider) Boot ¶
func (r *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (r *ServiceProvider) Register(app foundation.Application)
func (*ServiceProvider) Relationship ¶ added in v1.15.12
func (r *ServiceProvider) Relationship() binding.Relationship
type SessionGuard ¶ added in v1.15.12
type SessionGuard struct {
// contains filtered or unexported fields
}
func (*SessionGuard) Check ¶ added in v1.15.12
func (r *SessionGuard) Check() bool
func (*SessionGuard) Guest ¶ added in v1.15.12
func (r *SessionGuard) Guest() bool
func (*SessionGuard) ID ¶ added in v1.15.12
func (r *SessionGuard) ID() (token string, err error)
func (*SessionGuard) Login ¶ added in v1.15.12
func (r *SessionGuard) Login(user any) (token string, err error)
func (*SessionGuard) LoginUsingID ¶ added in v1.15.12
func (r *SessionGuard) LoginUsingID(id any) (token string, err error)
func (*SessionGuard) Logout ¶ added in v1.15.12
func (r *SessionGuard) Logout() error
func (*SessionGuard) Parse ¶ added in v1.15.12
func (r *SessionGuard) Parse(token string) (*contractsauth.Payload, error)
func (*SessionGuard) Refresh ¶ added in v1.15.12
func (r *SessionGuard) Refresh() (token string, err error)
func (*SessionGuard) User ¶ added in v1.15.12
func (r *SessionGuard) User(user any) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.