Documentation ¶
Index ¶
- Variables
- func ExtractToken(ctx *gin.Context) (token string)
- func GetLoginUserIDFromContext(ctx *gin.Context) (userID string)
- func GetLoginUserIDInt64FromContext(ctx *gin.Context) (userID int64)
- func GetUserInfoFromContext(ctx *gin.Context) (u *entity.UserCacheInfo)
- type AuthUserMiddleware
- type AvatarMiddleware
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSetMiddleware = wire.NewSet( NewAuthUserMiddleware, NewAvatarMiddleware, )
ProviderSetMiddleware is providers.
Functions ¶
func ExtractToken ¶
ExtractToken extract token from context
func GetLoginUserIDFromContext ¶
GetLoginUserIDFromContext get user id from context
func GetUserInfoFromContext ¶
func GetUserInfoFromContext(ctx *gin.Context) (u *entity.UserCacheInfo)
GetUserInfoFromContext get user info from context
Types ¶
type AuthUserMiddleware ¶
type AuthUserMiddleware struct {
// contains filtered or unexported fields
}
AuthUserMiddleware auth user middleware
func NewAuthUserMiddleware ¶
func NewAuthUserMiddleware(authService *auth.AuthService) *AuthUserMiddleware
NewAuthUserMiddleware new auth user middleware
func (*AuthUserMiddleware) Auth ¶
func (am *AuthUserMiddleware) Auth() gin.HandlerFunc
Auth get token and auth user, set user info to context if user is already login
func (*AuthUserMiddleware) CmsAuth ¶
func (am *AuthUserMiddleware) CmsAuth() gin.HandlerFunc
func (*AuthUserMiddleware) MustAuth ¶
func (am *AuthUserMiddleware) MustAuth() gin.HandlerFunc
MustAuth auth user info. If the user does not log in, an unauthenticated error is displayed
type AvatarMiddleware ¶
type AvatarMiddleware struct {
// contains filtered or unexported fields
}
func NewAvatarMiddleware ¶
func NewAvatarMiddleware(serviceConfig *service_config.ServiceConfig, uploaderService *uploader.UploaderService, ) *AvatarMiddleware
NewAvatarMiddleware new auth user middleware
func (*AvatarMiddleware) AvatarThumb ¶
func (am *AvatarMiddleware) AvatarThumb() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.