Documentation
¶
Index ¶
- Variables
- func FromContext(ctx context.Context) (*data.UserTokenPayload, error)
- func NewAuthMiddleware(authenticator engine.RequestAuthenticator, authorizer authzEngine.Engine, ...) middleware.Middleware
- func OptionalServer(authenticator engine.RequestAuthenticator, userToken *data.UserToken) middleware.Middleware
- func Server(userToken *data.UserToken) middleware.Middleware
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrongContext = errors.Unauthorized(reason, "wrong context for middleware") ErrMissingJwtToken = errors.Unauthorized(reason, "no jwt token in context") ErrExtractUserInfoFailed = errors.Unauthorized(reason, "extract user info failed") ErrExtractSubjectFailed = errors.Unauthorized(reason, "extract subject failed") ErrExtractTenantFailed = errors.Unauthorized(reason, "extract tenant failed") ErrAccessTokenNotExist = errors.Unauthorized(reason, "access token do not exists") ErrAccessTokenExpired = errors.Unauthorized(reason, "access token expired") )
View Source
var Action = authzEngine.Action("ANY")
Functions ¶
func FromContext ¶
func FromContext(ctx context.Context) (*data.UserTokenPayload, error)
func NewAuthMiddleware ¶
func NewAuthMiddleware(authenticator engine.RequestAuthenticator, authorizer authzEngine.Engine, userToken *data.UserToken, cfg *configv1.Authentication_Jwt) middleware.Middleware
NewAuthMiddleware 创建统一鉴权中间件,并按白名单规则决定鉴权链路。
func OptionalServer ¶
func OptionalServer(authenticator engine.RequestAuthenticator, userToken *data.UserToken) middleware.Middleware
OptionalServer 为白名单接口补充可选认证解析。
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
authn
module
|
|
|
engine/jwt
module
|
|
|
middleware
module
|
|
|
authz
module
|
|
|
engine/casbin
module
|
|
|
middleware
module
|
|
Click to show internal directories.
Click to hide internal directories.