Help us shape the future of Go! Take the 2026 Go Developer Survey

middleware

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TenantHeaderName is the request header carrying the tenant identifier.
	TenantHeaderName  = "x-tenant-id"
	MaxTenantIDLength = 64
	TenantIDPattern   = `^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$`
	TenantIDHint      = "x-tenant-id must match " + TenantIDPattern
)

Variables

This section is empty.

Functions

func ResolveTenant

func ResolveTenant(l logger.Interface) gin.HandlerFunc

ResolveTenant resolves, validates, and logs the request tenant. An absent header yields the empty tenant, which is what existing single-tenant rows are stored under. JWT claim resolution can replace the header lookup here without changing handler or use-case interfaces.

func TenantID

func TenantID(c *gin.Context) string

TenantID returns the tenant resolved by Tenant for the current request.

func ValidTenantID

func ValidTenantID(tenantID string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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