Documentation ¶
Index ¶
- Constants
- func IsAJAXRequest(r *fasthttp.Request) bool
- func SetAuthManager(ctx *fasthttp.RequestCtx, a FncAuth)
- type AjaxOnly
- type AuthBasic
- type AuthBearer
- func (a *AuthBearer) AdminAuth(ctx *fasthttp.RequestCtx) bool
- func (a *AuthBearer) Auth(ctx *fasthttp.RequestCtx) bool
- func (a *AuthBearer) GetToken(ctx *fasthttp.RequestCtx) TokenData
- func (a *AuthBearer) NewToken(userData TokenData) (string, error)
- func (a *AuthBearer) RemoveToken(s string) error
- func (a *AuthBearer) String() string
- type AuthServer
- type FncAuth
- type MapTokens
- type OAuth2
- type SimpleTokenData
- type TokenData
- type Tokens
Constants ¶
View Source
const ( Amazon = iota Bitbucket GitHub GitLab Facebook Instagram LinkedIn Microsoft Mira PayPal )
View Source
const UserValueToken = "UserToken"
Variables ¶
This section is empty.
Functions ¶
func IsAJAXRequest ¶ added in v1.2.130
IsAJAXRequest - is this AJAX-request
func SetAuthManager ¶ added in v1.2.93
func SetAuthManager(ctx *fasthttp.RequestCtx, a FncAuth)
Types ¶
type AjaxOnly ¶ added in v1.2.93
type AjaxOnly struct {
// contains filtered or unexported fields
}
AjaxOnly wrap auth manager for ajax endpoint on case full refresh web-page
func NewAjaxOnly ¶ added in v1.2.93
func (*AjaxOnly) AdminAuth ¶ added in v1.2.93
func (r *AjaxOnly) AdminAuth(ctx *fasthttp.RequestCtx) bool
func (*AjaxOnly) GetAuthManager ¶ added in v1.2.93
func (r *AjaxOnly) GetAuthManager(ctx *fasthttp.RequestCtx, isAdmin bool) bool
type AuthBasic ¶ added in v1.0.11512
type AuthBasic struct { NewTokenData fncNewTokenData // contains filtered or unexported fields }
func NewAuthBasic ¶ added in v1.0.11512
func (*AuthBasic) AdminAuth ¶ added in v1.0.11512
func (a *AuthBasic) AdminAuth(ctx *fasthttp.RequestCtx) bool
type AuthBearer ¶
type AuthBearer struct {
// contains filtered or unexported fields
}
func NewAuthBearer ¶
func NewAuthBearer(tokens Tokens) *AuthBearer
func (*AuthBearer) AdminAuth ¶
func (a *AuthBearer) AdminAuth(ctx *fasthttp.RequestCtx) bool
func (*AuthBearer) Auth ¶
func (a *AuthBearer) Auth(ctx *fasthttp.RequestCtx) bool
func (*AuthBearer) GetToken ¶
func (a *AuthBearer) GetToken(ctx *fasthttp.RequestCtx) TokenData
func (*AuthBearer) NewToken ¶ added in v1.0.11512
func (a *AuthBearer) NewToken(userData TokenData) (string, error)
func (*AuthBearer) RemoveToken ¶ added in v1.0.11512
func (a *AuthBearer) RemoveToken(s string) error
func (*AuthBearer) String ¶
func (a *AuthBearer) String() string
type AuthServer ¶ added in v1.2.3
type AuthServer uint8
type FncAuth ¶ added in v1.2.93
type FncAuth interface { Auth(ctx *fasthttp.RequestCtx) bool AdminAuth(ctx *fasthttp.RequestCtx) bool String() string }
func GetAuthManager ¶ added in v1.2.93
func GetAuthManager(ctx *fasthttp.RequestCtx) (a FncAuth, ok bool)
type MapTokens ¶ added in v1.0.11512
type MapTokens struct {
// contains filtered or unexported fields
}
func NewMapTokens ¶ added in v1.0.11512
func (*MapTokens) RemoveToken ¶ added in v1.0.11512
type OAuth2 ¶ added in v1.2.3
type OAuth2 struct { *oauth2.Config *AuthBearer }
func NewOAuth2WithCustomTokens ¶ added in v1.2.3
func (*OAuth2) AdminAuth ¶ added in v1.2.3
func (a *OAuth2) AdminAuth(ctx *fasthttp.RequestCtx) bool
func (*OAuth2) DoAuth ¶ added in v1.2.3
func (a *OAuth2) DoAuth(ctx *fasthttp.RequestCtx, s AuthServer, state string, authOpts ...oauth2.AuthCodeOption) error
type SimpleTokenData ¶ added in v1.2.8
type SimpleTokenData struct { Name string `json:"name"` Desc string `json:"desc"` Lang string `json:"lang"` Token string `json:"token"` Expiry time.Time `json:"expiry,omitempty"` Extensions map[string]any `json:"extensions,omitempty"` Id int `json:"id"` Admin bool `json:"admin"` }
func NewSimpleTokenData ¶ added in v1.2.8
func (*SimpleTokenData) GetUserID ¶ added in v1.2.8
func (s *SimpleTokenData) GetUserID() int
func (*SimpleTokenData) IsAdmin ¶ added in v1.2.8
func (s *SimpleTokenData) IsAdmin() bool
func (*SimpleTokenData) IsNotExpired ¶ added in v1.2.50
func (s *SimpleTokenData) IsNotExpired() bool
func (*SimpleTokenData) WithExtension ¶ added in v1.2.47
func (s *SimpleTokenData) WithExtension(key string, value any) *SimpleTokenData
WithExtension sets extension to SimpleTokenData.Extensions and returns SimpleTokenData.
func (*SimpleTokenData) WithToken ¶ added in v1.2.48
func (s *SimpleTokenData) WithToken(token string) *SimpleTokenData
WithToken sets token and returns SimpleTokenData.
Click to show internal directories.
Click to hide internal directories.