Documentation ¶
Overview ¶
Package middleware provides middleware for handling common tasks like user identity verification (token validation).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware handles HTTP request interception and user authorization.
func New ¶
func New(services *service.Service, logger *slog.Logger) *Middleware
New creates and returns a new instance of Middleware with the provided services and logger.
func (*Middleware) UserIdentity ¶
func (h *Middleware) UserIdentity(ctx *gin.Context)
UserIdentity is a middleware function that checks the authorization header and parses the user ID. @Summary Verifies the user identity from the authorization token. @Description This middleware validates the presence and correctness of the authorization token in the HTTP request header. @Tags Middleware @Accept json @Produce json @Security ApiKeyAuth @Failure 401 @Router /api/v1 [get]