middleware

package
v0.0.0-...-f265f0c Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT-0 Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

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