middlewares

package
v0.0.0-...-0ce47a5 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderAuthorization = "Authorization"
	HeaderAPIKey        = "X-API-Key"
	HeaderInstanceID    = "X-Instance-ID"
)

Variables

This section is empty.

Functions

func CheckOTP

func CheckOTP(otpConf []OTPConfig, tokenSignKey string, globalInfosDBService *globalinfosDB.GlobalInfosDBService) gin.HandlerFunc

func GetAndValidateManagementUserJWT

func GetAndValidateManagementUserJWT(tokenSignKey string) gin.HandlerFunc

Can be used by other services to validate the JWT token of the management users

func GetAndValidateParticipantUserJWT

func GetAndValidateParticipantUserJWT(tokenSignKey string, globalInfosDBService *globalinfosDB.GlobalInfosDBService) gin.HandlerFunc

func GetAndValidateParticipantUserJWTWithIgnoringExpiration

func GetAndValidateParticipantUserJWTWithIgnoringExpiration(tokenSignKey string, globalInfosDBService *globalinfosDB.GlobalInfosDBService) gin.HandlerFunc

func HasValidAPIKey

func HasValidAPIKey(validKeys []string) gin.HandlerFunc

func IsAdminUser

func IsAdminUser() gin.HandlerFunc

func ManagementAuthMiddleware

func ManagementAuthMiddleware(tokenSignKey string, allowedInstanceIds []string, muDB *mudb.ManagementUserDBService) gin.HandlerFunc

func RequirePayload

func RequirePayload() gin.HandlerFunc

RequirePayload blocks post requests that have no payload attached

Types

type OTPConfig

type OTPConfig struct {
	Route  string              `json:"route" yaml:"route"`
	Method string              `json:"method" yaml:"method"`
	Exact  bool                `json:"exact" yaml:"exact"`
	MaxAge time.Duration       `json:"maxAge" yaml:"max_age"`
	Types  []userTypes.OTPType `json:"types" yaml:"types"`
}

Jump to

Keyboard shortcuts

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