middleware

package
v0.0.0-...-fb81480 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 6 Imported by: 0

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]

Jump to

Keyboard shortcuts

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