Documentation ¶
Index ¶
- Constants
- Variables
- func BannedUserMiddleware() gin.HandlerFunc
- func CorsMiddleware() gin.HandlerFunc
- func DeletedUserMiddleware() gin.HandlerFunc
- func ErrorMiddleware() gin.HandlerFunc
- func JWTMiddleware(cfg config.JWTConfig, bannedTokenRepo repo.BannedTokenRepository) gin.HandlerFunc
- func LocaleMiddleware(bundle *i18n.Bundle) gin.HandlerFunc
- func LoggerMiddleware() gin.HandlerFunc
- func MemoryRateLimitMiddleware(rps int) gin.HandlerFunc
- func RecoveryMiddleware() gin.HandlerFunc
- func RedisRateLimitMiddleware(redisClient redis.UniversalClient, rps int) gin.HandlerFunc
- func RoleMiddleware(roles ...string) gin.HandlerFunc
- func SecurityHeadersMiddleware() gin.HandlerFunc
- type AuthUser
Constants ¶
View Source
const (
AuthUserKey = "authUser"
)
Variables ¶
View Source
var ( ErrJwtTokenIsMissing = dto.NewI18nError("JWT token is missing", "errors.session_invalid") ErrInvalidJwtToken = dto.NewI18nError("invalid JWT token", "errors.session_invalid") ErrExpiredJwtToken = dto.NewI18nError("expired JWT token", "errors.session_expired") ErrBannedJwtToken = dto.NewI18nError("banned JWT token", "errors.session_banned") ErrUserNotFound = dto.NewI18nError("user not found", "errors.user_not_found") )
View Source
var ( LangKey = "lang" LocalizerKey = "localizer" )
View Source
var (
ErrAccessDenied = dto.NewI18nError("access denied", "errors.access_denied")
)
View Source
var (
ErrBannedUser = dto.NewI18nError("banned user", "errors.banned_user")
)
View Source
var (
ErrDeletedUser = dto.NewI18nError("deleted user", "errors.deleted_user")
)
View Source
var (
ErrTooManyRequests = dto.NewI18nError("too many requests", "errors.too_many_requests")
)
Functions ¶
func BannedUserMiddleware ¶
func BannedUserMiddleware() gin.HandlerFunc
BannedUserMiddleware
Use strictly after adding JWT middleware
func CorsMiddleware ¶
func CorsMiddleware() gin.HandlerFunc
func DeletedUserMiddleware ¶
func DeletedUserMiddleware() gin.HandlerFunc
DeletedUserMiddleware
Use strictly after adding JWT middleware
func ErrorMiddleware ¶
func ErrorMiddleware() gin.HandlerFunc
func JWTMiddleware ¶
func JWTMiddleware(cfg config.JWTConfig, bannedTokenRepo repo.BannedTokenRepository) gin.HandlerFunc
func LocaleMiddleware ¶
func LocaleMiddleware(bundle *i18n.Bundle) gin.HandlerFunc
func LoggerMiddleware ¶
func LoggerMiddleware() gin.HandlerFunc
func MemoryRateLimitMiddleware ¶
func MemoryRateLimitMiddleware(rps int) gin.HandlerFunc
func RecoveryMiddleware ¶
func RecoveryMiddleware() gin.HandlerFunc
func RedisRateLimitMiddleware ¶
func RedisRateLimitMiddleware(redisClient redis.UniversalClient, rps int) gin.HandlerFunc
func RoleMiddleware ¶
func RoleMiddleware(roles ...string) gin.HandlerFunc
func SecurityHeadersMiddleware ¶
func SecurityHeadersMiddleware() gin.HandlerFunc
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.