auth_middleware

package
v0.0.0-...-e796f14 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LocalsUserKey      = "__user__"
	AccessTokenUUIDKey = "__access_token_uuid__"
	JWTClaimsKey       = "__jwtClaims__"
)
View Source
var AuthMiddlewareConfigDefault = AuthMiddlewareConfig{
	Filter:       nil,
	Decode:       nil,
	Unauthorized: nil,
}

Functions

func ExtractAssessTokenFromCookies

func ExtractAssessTokenFromCookies(ctx fiber.Ctx) string

func ExtractRefreshTokenFromCookies

func ExtractRefreshTokenFromCookies(ctx fiber.Ctx) string

func ExtractUser

func ExtractUser(ctx fiber.Ctx) *models.UsersModel

func NewAuthMiddleware

func NewAuthMiddleware(config AuthMiddlewareConfig) fiber.Handler

NewAuthMiddleware validate accessToken in Keycloak and parse it, extract user from DB

func ResetCookies

func ResetCookies(c fiber.Ctx)

Types

type AuthMiddlewareConfig

type AuthMiddlewareConfig struct {
	Filter       func(ctx fiber.Ctx) bool
	UR           *repositories.UserRepository
	JWT          *services.JWTAuthenticator
	Unauthorized fiber.Handler
	Decode       func(ctx fiber.Ctx) (*jwt.MapClaims, error)
}

Jump to

Keyboard shortcuts

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