Documentation ¶
Index ¶
- Constants
- func AuthMiddleware(secret string, casbinEnforcer *casbin.Enforcer, cryptos cryptos.Cryptos, ...) gin.HandlerFunc
- func AuthPublicMiddleware(secret string, casbinEnforcer *casbin.Enforcer, cryptos cryptos.Cryptos, ...) gin.HandlerFunc
- func CorsMiddleware() gin.HandlerFunc
- func GetAuthContext(c *gin.Context, cryptos cryptos.Cryptos, tokenType string) (token string, err error)
- func GetUserContext(c *gin.Context, cryptos cryptos.Cryptos) (userID string, userRole string)
- func JwtAuthMiddleware(secret string, casbinEnforcer *casbin.Enforcer, cryptos cryptos.Cryptos, ...) gin.HandlerFunc
- func SetAuthContext(c *gin.Context, cryptos cryptos.Cryptos, accessToken string, ...) error
- func SetAuthCookies(accessToken string, refreshToken string) gin.HandlerFunc
- func SetUserContext(c *gin.Context, cryptos cryptos.Cryptos, userID, userRole string)
Constants ¶
View Source
const ( LoginUrlRedirect = "/login" DashboardUrlRedirect = "/dashboard" )
View Source
const ( UserIDContext = "x-user-id" UserRoleContext = "x-user-role" AuthAccessContext = "x-a-auth" AuthRefreshContext = "x-r-auth" RoleSuperAdmin = "super_admin" RoleAdmin = "admin" RoleStaff = "staff" RoleAnonymous = "anonymous" RefreshToken = "refresh_token" AccessToken = "access_token" )
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(secret string, casbinEnforcer *casbin.Enforcer, cryptos cryptos.Cryptos, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) gin.HandlerFunc
func AuthPublicMiddleware ¶
func AuthPublicMiddleware(secret string, casbinEnforcer *casbin.Enforcer, cryptos cryptos.Cryptos, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) gin.HandlerFunc
func CorsMiddleware ¶
func CorsMiddleware() gin.HandlerFunc
func GetAuthContext ¶
func GetUserContext ¶
func JwtAuthMiddleware ¶
func JwtAuthMiddleware(secret string, casbinEnforcer *casbin.Enforcer, cryptos cryptos.Cryptos, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) gin.HandlerFunc
func SetAuthContext ¶
func SetAuthCookies ¶
func SetAuthCookies(accessToken string, refreshToken string) gin.HandlerFunc
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.