middlewares

package
v0.0.0-...-fe06dec Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PSKClientIdHeader = "x-rh-cloud-connector-client-id"
	PSKOrgIdHeader    = "x-rh-cloud-connector-org-id"
	PSKAccountHeader  = "x-rh-cloud-connector-account"
	PSKHeader         = "x-rh-cloud-connector-psk"
)

Variables

This section is empty.

Functions

func EnforceTurnpikeAuthentication

func EnforceTurnpikeAuthentication(next http.Handler) http.Handler

EnforceTurnpikeAuthentication requires that the request be authenticated against Turnpike This middlware must be installed after the RedHatInsights Identity middleware

Types

type AuthMiddleware

type AuthMiddleware struct {
	Secrets                  map[string]interface{}
	IdentityAuth             func(http.Handler) http.Handler
	RequiredTenantIdentifier RequiredTenantIdentifier
}

func (*AuthMiddleware) Authenticate

func (amw *AuthMiddleware) Authenticate(next http.Handler) http.Handler

Authenticate determines which authentication method should be used, and delegates identity header auth to the identity middleware

type MetricsMiddleware

type MetricsMiddleware struct {
}

MetricsMiddleware allows the passage of parameters into the metrics middleware

func (*MetricsMiddleware) RecordHTTPMetrics

func (mw *MetricsMiddleware) RecordHTTPMetrics(next http.Handler) http.Handler

type Principal

type Principal interface {
	GetAccount() string
	GetOrgID() string
}

Principal interface can be implemented and expanded by various principal objects (type depends on middleware being used)

func GetPrincipal

func GetPrincipal(ctx context.Context) (Principal, bool)

GetPrincipal takes the request context and determines which middleware (identity header vs service to service) was used before returning a principal object.

type RequiredTenantIdentifier

type RequiredTenantIdentifier int
const (
	Account RequiredTenantIdentifier = iota
	OrgID
)

Jump to

Keyboard shortcuts

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