Documentation ¶
Index ¶
- Variables
- func BanAPIForUserCenter(ctx *gin.Context)
- func ExtractAndSetAcceptLanguage(ctx *gin.Context)
- func ExtractToken(ctx *gin.Context) (token string)
- func GetIsAdminFromContext(ctx *gin.Context) (isAdmin bool)
- func GetLoginUserIDFromContext(ctx *gin.Context) (userID string)
- func GetLoginUserIDInt64FromContext(ctx *gin.Context) (userID int64)
- func GetUserInfoFromContext(ctx *gin.Context) (u *entity.UserCacheInfo)
- func HeadersByRequestURI() gin.HandlerFunc
- type AuthUserMiddleware
- type AvatarMiddleware
Constants ¶
This section is empty.
Variables ¶
var ProviderSetMiddleware = wire.NewSet( NewAuthUserMiddleware, NewAvatarMiddleware, )
ProviderSetMiddleware is providers.
Functions ¶
func BanAPIForUserCenter ¶ added in v1.1.0
BanAPIForUserCenter ban api for user center
func ExtractAndSetAcceptLanguage ¶ added in v1.0.0
ExtractAndSetAcceptLanguage extract accept language from header and set to context
func ExtractToken ¶
ExtractToken extract token from context
func GetIsAdminFromContext ¶ added in v0.4.2
GetIsAdminFromContext get user is admin 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
func HeadersByRequestURI ¶ added in v1.1.0
func HeadersByRequestURI() gin.HandlerFunc
Types ¶
type AuthUserMiddleware ¶
type AuthUserMiddleware struct {
// contains filtered or unexported fields
}
AuthUserMiddleware auth user middleware
func NewAuthUserMiddleware ¶
func NewAuthUserMiddleware( authService *auth.AuthService, siteInfoCommonService *siteinfo_common.SiteInfoCommonService) *AuthUserMiddleware
NewAuthUserMiddleware new auth user middleware
func (*AuthUserMiddleware) AdminAuth ¶ added in v1.0.1
func (am *AuthUserMiddleware) AdminAuth() gin.HandlerFunc
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) EjectUserBySiteInfo ¶ added in v1.0.0
func (am *AuthUserMiddleware) EjectUserBySiteInfo() gin.HandlerFunc
EjectUserBySiteInfo if admin config the site can access by nologin user, eject user.
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