Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Protected ¶
func Protected(jwtSecret string) fiber.Handler
Protected creates a middleware handler that protects routes using JWT authentication. It checks the Authorization header for a valid JWT token, extracts the user ID from the token, and sets it in the request context for further use in the application. If the token is invalid or not present, it returns a 401 Unauthorized response.
Parameters: - jwtSecret: The secret key used to sign the JWT token.
Returns: - fiber.Handler: The Fiber middleware handler for JWT authentication.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.