middleware

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TraceIdKey           = "trace_id"
	SubKey               = "sub"
	NameKey              = "name"
	NicknameKey          = "nickname"
	EmailKey             = "email"
	EmailVerifiedKey     = "email_verified"
	PictureKey           = "picture"
	RolesKey             = "roles"
	OrgIdKey             = "org_id"
	TenantIdKey          = "tenant_id"
	TenantDisplayNameKey = "tenant_display_name"
)
View Source
const (
	RolesHeader   string = "X-roles"
	NoRolesHeader string = "no-x-roles-povided"
)
View Source
const (
	TenantIdHeader               string = "X-tenant-id"
	TenantDisplayNameHeader      string = "X-tenant-display-name"
	ErrTenantIdRequired          string = "Tenant ID is required"
	ErrTenantDisplayNameRequired string = "Tenant display name is required"
)

Variables

This section is empty.

Functions

func New

func New(l logger.Logger) *middleware

Types

type Middleware

type Middleware interface {
	Chain(middlewares ...middlewares) middlewares
	Exclude(excluded *regexp.Regexp)
	LogRequest(next http.Handler) http.Handler
	RecoverPanic(next http.Handler) http.Handler
	AddTraceIdFromHeaderToContext(next http.Handler) http.Handler
	GetTraceIdFromContext(r *http.Request) string
	AddOrgIdForUserFromHeaderToContext(next http.Handler) http.Handler
	GetOrgIdForUserFromContext(r *http.Request) string
	AddUserSubFromHeaderToContext(next http.Handler) http.Handler
	GetUserSubFromContext(r *http.Request) string
	AddUserNameFromHeaderToContext(next http.Handler) http.Handler
	GetUserNameFromContext(r *http.Request) string
	AddUserNicknameFromHeaderToContext(next http.Handler) http.Handler
	GetUserNicknameFromContext(r *http.Request) string
	AddUserEmailFromHeaderToContext(next http.Handler) http.Handler
	GetUserEmailFromContext(r *http.Request) string
	AddUserPictureFromHeaderToContext(next http.Handler) http.Handler
	GetUserPictureFromContext(r *http.Request) string
	AddTenantIdFromHeaderToContext(next http.Handler) http.Handler
	GetTenantIdFromContext(r *http.Request) string
	AddTenantDisplayNameFromHeaderToContext(next http.Handler) http.Handler
	GetTenantDisplayNameFromContext(r *http.Request) string
	AddRolesFromHeaderToContext(next http.Handler) http.Handler
	GetRoles(r *http.Request) []string
	Gzip(next http.Handler) http.Handler
}

Jump to

Keyboard shortcuts

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