Documentation ¶
Overview ¶
Package mid provides app level middleware support.
Index ¶
- Variables
- func Authenticate(log *logger.Logger, client *authclient.Client) gin.HandlerFunc
- func AuthenticateLocal(auth *auth.Auth) gin.HandlerFunc
- func Authorize(log *logger.Logger, client *authclient.Client, rule string) gin.HandlerFunc
- func AuthorizeUser(log *logger.Logger, client *authclient.Client, userBus *userbus.Business, ...) gin.HandlerFunc
- func Basic() gin.HandlerFunc
- func Bearer(ath *auth.Auth) gin.HandlerFunc
- func CheckError() gin.HandlerFunc
- func Errors(log *logger.Logger) gin.HandlerFunc
- func GetClaims(ctx context.Context) auth.Claims
- func GetUser(ctx context.Context) (userbus.User, error)
- func GetUserID(ctx context.Context) (uuid.UUID, error)
- func Logger(log *logger.Logger) gin.HandlerFunc
- func Metrics() gin.HandlerFunc
- func Panics() gin.HandlerFunc
- func Trace() gin.HandlerFunc
- type Handler
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidID = errors.New("ID is not in its proper form")
ErrInvalidID represents a condition where the id is not a uuid.
Functions ¶
func Authenticate ¶
func Authenticate(log *logger.Logger, client *authclient.Client) gin.HandlerFunc
Authenticate 通过 auth 服务验证身份验证
func AuthenticateLocal ¶
func AuthenticateLocal(auth *auth.Auth) gin.HandlerFunc
AuthenticateLocal validates a JWT from the `Authorization` header. AuthenticateLocal 通过 “Authorization” 标头验证 JWT。 AuthenticateLocal 本地处理验证
func Authorize ¶
func Authorize(log *logger.Logger, client *authclient.Client, rule string) gin.HandlerFunc
Authorize executes the specified role and does not extract any domain data.
func AuthorizeUser ¶
func AuthorizeUser(log *logger.Logger, client *authclient.Client, userBus *userbus.Business, rule string) gin.HandlerFunc
AuthorizeUser executes the specified role and extracts the specified user from the DB if a user id is specified in the call. Depending on the rule specified, the userid from the claims may be compared with the specified user id.
func Bearer ¶
func Bearer(ath *auth.Auth) gin.HandlerFunc
Bearer processes JWT authentication logic.
func CheckError ¶
func CheckError() gin.HandlerFunc
func Metrics ¶
func Metrics() gin.HandlerFunc
func Panics ¶
func Panics() gin.HandlerFunc
func Trace ¶
func Trace() gin.HandlerFunc
Types ¶
Click to show internal directories.
Click to hide internal directories.