tenant

package
v0.0.0-weekly-f4-test-... Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTenantID = "anonymous"

DefaultTenantID is the default tenant ID used when the interceptor is disabled.

View Source
const ErrNoTenantID = user.ErrNoOrgID

Variables

This section is empty.

Functions

func ExtractTenantIDFromContext

func ExtractTenantIDFromContext(ctx context.Context) (string, error)

ExtractTenantIDFromContext extracts a single TenantID from the context.

func ExtractTenantIDFromHeaders

func ExtractTenantIDFromHeaders(ctx context.Context, headers http.Header) (string, context.Context, error)

ExtractTenantIDFromHeaders extracts a single TenantID from http headers.

func InjectTenantID

func InjectTenantID(ctx context.Context, tenantID string) context.Context

func NewAuthInterceptor

func NewAuthInterceptor(enabled bool) connect.Interceptor

NewAuthInterceptor create a new tenant authentication interceptor for the server and client.

For the server:

If enabled, the interceptor will check the tenant ID in the request header is present and inject it into the context. When the interceptor is disabled, it will inject the default tenant ID into the context.

For the client :

The interceptor will inject the tenant ID from the context into the request header no matter if the interceptor is enabled or not.

Types

This section is empty.

Jump to

Keyboard shortcuts

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