identity

package
v0.0.0-...-1e7b23d Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TenantHeaderKey = "X-Tenant-ID"

	ErrMisTenantID = errors.New("miss tenant id")
)
View Source
var (
	ErrInvalidUserID = errors.New("invalid user")
)

Functions

func RegistryTenantIDMiddleware

func RegistryTenantIDMiddleware() web.Option

RegistryTenantIDMiddleware register a middleware to get tenant id from request header

func TenantIDFromContext

func TenantIDFromContext(ctx context.Context) (id int, err error)

TenantIDFromContext returns the tenant id from context.tenant id is int format

func TenantIDMiddleware

func TenantIDMiddleware(cfg *conf.Configuration) gin.HandlerFunc

TenantIDMiddleware returns middleware to get tenant id from http request

func UserIDFromContext

func UserIDFromContext(ctx context.Context) (int, error)

func WithTenantID

func WithTenantID(parent context.Context, id int) context.Context

Types

type TenantOptions

type TenantOptions struct {
	Lookup     string
	RootDomain string
	Exclude    []string
	Skipper    handler.Skipper
}

Jump to

Keyboard shortcuts

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