middleware

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSetMiddleware is providers.

Functions

func ExtractToken

func ExtractToken(ctx *gin.Context) (token string)

ExtractToken extract token from context

func GetLoginUserIDFromContext

func GetLoginUserIDFromContext(ctx *gin.Context) (userID string)

GetLoginUserIDFromContext get user id from context

func GetLoginUserIDInt64FromContext

func GetLoginUserIDInt64FromContext(ctx *gin.Context) (userID int64)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL