Documentation
¶
Index ¶
- Constants
- func GetUser(c *gin.Context) *model.User
- func Logging() gin.HandlerFunc
- func OptionalAuth(authSvc *auth.Service) gin.HandlerFunc
- func RequestID() gin.HandlerFunc
- func RequireAuth(authSvc *auth.Service) gin.HandlerFunc
- func RequireRole(roles ...string) gin.HandlerFunc
- func SecurityHeaders() gin.HandlerFunc
- func WebOptionalAuth(authSvc *auth.Service) gin.HandlerFunc
- type RateLimiter
Constants ¶
View Source
const RequestIDHeader = "X-Request-Id"
View Source
const (
UserContextKey = "user"
)
Variables ¶
This section is empty.
Functions ¶
func Logging ¶
func Logging() gin.HandlerFunc
func OptionalAuth ¶
func OptionalAuth(authSvc *auth.Service) gin.HandlerFunc
func RequestID ¶
func RequestID() gin.HandlerFunc
func RequireAuth ¶
func RequireAuth(authSvc *auth.Service) gin.HandlerFunc
func RequireRole ¶
func RequireRole(roles ...string) gin.HandlerFunc
func SecurityHeaders ¶
func SecurityHeaders() gin.HandlerFunc
SecurityHeaders adds standard security headers to all responses.
func WebOptionalAuth ¶
func WebOptionalAuth(authSvc *auth.Service) gin.HandlerFunc
WebOptionalAuth is an alias for OptionalAuth, used on web routes. It reads from both Authorization header and session_token cookie.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(cfg config.RateLimitConfig) *RateLimiter
func (*RateLimiter) RateLimit ¶
func (rl *RateLimiter) RateLimit(bucketType string) gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.