Documentation
¶
Index ¶
- Constants
- Variables
- func New(opts ...Option) *config
- type JWTData
- type Option
- func WithAuthErrFn(fn func(err error) string) Option
- func WithAuthOkFn(fn func(token string) string) Option
- func WithAutoKeepAlive(on bool) Option
- func WithSecret(secret []byte) Option
- func WithTTL(ttl time.Duration) Option
- func WithUser(name, pwd string) Option
- func WithUserList(users map[string]string) Option
- type User
Constants ¶
View Source
const ( DefaultHeadersAuthField = "Authorization" DefaultTokenPrefix = "Bearer " )
Variables ¶
View Source
var ( DefaultSecret = []byte("zbaseauth_secret") DefaultTTL time.Duration = 600e9 )
View Source
var ( DefaultJWTAlgorithm = jwt.SigningMethodHS512 DefaultJWTAlgorithmName = "HS512" )
Functions ¶
Types ¶
type JWTData ¶
type JWTData struct { jwt.StandardClaims User string `json:"user"` }
func (*JWTData) ParserString ¶
解析jwt数据
Click to show internal directories.
Click to hide internal directories.