Documentation ¶
Index ¶
- Constants
- func RandString(n int) string
- func Some(target interface{}, initValue interface{}) interface{}
- type Identify
- func (iden *Identify) AddOptions(opts ...Option) *Identify
- func (iden *Identify) GetToken(ctx *gin.Context) *Token
- func (iden *Identify) Init(init func(*Identify)) *Identify
- func (iden *Identify) ObtainToken(extra interface{}) (*Token, error)
- func (iden *Identify) Plugin(router *gin.RouterGroup, httpProxy *gin.Engine) *Identify
- func (iden *Identify) SetToken(ctx *gin.Context, token *Token)
- func (iden *Identify) VerifyContext(ctx *gin.Context) bool
- func (iden *Identify) VerifyToken(token string) bool
- type Model
- type Option
- type RedisModel
- type RoutesGroup
- type Token
Constants ¶
View Source
const IdenKey = "identify"
IdenKey defined ctx key
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Identify ¶
type Identify struct { Auth func(c *gin.Context) (interface{}, error) Iden func(c *gin.Context) ExpiresIn int64 Routes RoutesGroup Model Model FakeURLs *[]string FakeTokens *[]string }
Identify authentication interface
func (*Identify) AddOptions ¶
AddOptions defined add option
func (*Identify) ObtainToken ¶
ObtainToken accessToken
func (*Identify) VerifyContext ¶
VerifyContext defined verify
func (*Identify) VerifyToken ¶
VerifyToken defined verify
type Model ¶
type Model interface { Save(*Token) (*Token, error) Find(*Token) (*Token, error) Revoke(*Token) error }
Model defined
type Option ¶
type Option func(*Identify) interface{}
Option defined implement of option
func AuthOption ¶
AuthOption defined auth
type RedisModel ¶
RedisModel token store
func (*RedisModel) Find ¶
func (model *RedisModel) Find(token *Token) (*Token, error)
Find find a token
func (*RedisModel) Revoke ¶
func (model *RedisModel) Revoke(token *Token) error
Revoke revoke a token
type RoutesGroup ¶
type RoutesGroup struct { ObtainTokenRoute string RevokeTokenRoute string RefleshTokenRoute string IdenTokenRoute string }
RoutesGroup iden routes
Click to show internal directories.
Click to hide internal directories.