Documentation
¶
Index ¶
- Constants
- func GetTokenDataFromCtx(ctx context.Context) (*jwtx.JwtTokenData, error)
- func GetTokenFromRequest(r *http.Request) (string, error)
- func IsAuthorize(next http.HandlerFunc, canAccess func() (CanAccess, error)) http.HandlerFunc
- func WithTokenContext(ctx context.Context, r *http.Request, secret string) (*http.Request, error)
- func WithTokenDataContext(ctx context.Context, r *http.Request, data jwtx.JwtTokenData) (*http.Request, error)
- type CanAccess
- type UserContextKey
Constants ¶
View Source
const ( REFESH_TOKEN_EXPIRED_AT = "refresh-token-expired-at" TOKEN_EXPIRED_AT = "access-token-expired-at" )
View Source
const (
UserContext = UserContextKey("UserContext")
)
Variables ¶
This section is empty.
Functions ¶
func GetTokenDataFromCtx ¶
func GetTokenDataFromCtx(ctx context.Context) (*jwtx.JwtTokenData, error)
从ctx获取用户请求内容
func GetTokenFromRequest ¶
读取Request Header Authorization
func IsAuthorize ¶ added in v1.3.29
func IsAuthorize(next http.HandlerFunc, canAccess func() (CanAccess, error)) http.HandlerFunc
func WithTokenContext ¶
设置请求token的上下文
Types ¶
type UserContextKey ¶
type UserContextKey string
Click to show internal directories.
Click to hide internal directories.