header

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 7

README

Aserto Shared Header package

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValueMachineAccountConnectionID = CtxKey("machine-account-connection-id")
	ValueMachineAccountCertID       = CtxKey("machine-account-cert-id")
)

If a call is authenticated with a machine account, these hold info about the connection and cert that resolved that machine account.

View Source
var (
	HeaderAsertoTenantID  = CtxKey(textproto.CanonicalMIMEHeaderKey("Aserto-Tenant-Id"))
	HeaderAsertoAccountID = CtxKey(textproto.CanonicalMIMEHeaderKey("Aserto-Account-Id"))
	HeaderAsertoTenantKey = CtxKey(textproto.CanonicalMIMEHeaderKey("Aserto-Api-Key"))
	HeaderAsertoRequestID = CtxKey(textproto.CanonicalMIMEHeaderKey("Aserto-Request-Id"))
	HeaderAsertoSessionID = CtxKey(textproto.CanonicalMIMEHeaderKey("Aserto-Session-Id"))

	HeaderAsertoTenantIDLowercase  = CtxKey(strings.ToLower(string(HeaderAsertoTenantID)))
	HeaderAsertoAccountIDLowercase = CtxKey(strings.ToLower(string(HeaderAsertoAccountID)))
	HeaderAsertoTenantKeyLowercase = CtxKey(strings.ToLower(string(HeaderAsertoTenantKey)))
	HeaderAsertoRequestIDLowercase = CtxKey(strings.ToLower(string(HeaderAsertoRequestID)))
	HeaderAsertoSessionIDLowercase = CtxKey(strings.ToLower(string(HeaderAsertoSessionID)))
)

Functions

func ContextWithAccountID

func ContextWithAccountID(ctx context.Context, accountID string) context.Context

func ContextWithRequestID

func ContextWithRequestID(ctx context.Context, requestID string) context.Context

func ContextWithSessionID

func ContextWithSessionID(ctx context.Context, sessionID string) context.Context

func ContextWithTenantID

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

func ExtractAccountID

func ExtractAccountID(ctx context.Context) string

func ExtractRequestID

func ExtractRequestID(ctx context.Context) string

func ExtractSessionID

func ExtractSessionID(ctx context.Context) string

func ExtractTenantID

func ExtractTenantID(ctx context.Context) string

func ExtractTenantKey

func ExtractTenantKey(ctx context.Context) string

func IncomingHeaderMatcher

func IncomingHeaderMatcher(key string) (string, bool)

IncomingHeaderMatcher is a matcher that makes it so that HTTP clients do not have to prefix the header key with Grpc-Metadata-. see https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/customizing_your_gateway/#mapping-from-http-request-headers-to-grpc-client-metadata

func IsValidUUID

func IsValidUUID(uid string) bool

func KnownContextValueStrings

func KnownContextValueStrings(ctx context.Context) map[string]interface{}

KnownContextValueStrings is the same as KnownContextValues, but uses string keys (useful for logging).

func KnownContextValues

func KnownContextValues(ctx context.Context) map[interface{}]interface{}

func OutgoingHeaderMatcher

func OutgoingHeaderMatcher(key string) (string, bool)

OutgoingHeaderMatcher filters headers that are allowed to reach the client.

Types

type CtxKey

type CtxKey string

Jump to

Keyboard shortcuts

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