upstreamswap

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package upstreamswap provides middleware for exchanging embedded auth server access tokens with upstream IdP tokens.

Index

Constants

View Source
const (
	// HeaderStrategyReplace replaces the Authorization header with the upstream token.
	HeaderStrategyReplace = "replace"
	// HeaderStrategyCustom adds the upstream token to a custom header.
	HeaderStrategyCustom = "custom"
)

Header injection strategy constants

View Source
const MiddlewareType = "upstreamswap"

MiddlewareType is the type identifier for upstream swap middleware.

Variables

This section is empty.

Functions

func CreateMiddleware

func CreateMiddleware(config *types.MiddlewareConfig, runner types.MiddlewareRunner) error

CreateMiddleware is the factory function for upstream swap middleware.

Types

type Config

type Config struct {
	// HeaderStrategy determines how to inject the token: "replace" (default) or "custom".
	HeaderStrategy string `json:"header_strategy,omitempty" yaml:"header_strategy,omitempty"`

	// CustomHeaderName is the header name when HeaderStrategy is "custom".
	CustomHeaderName string `json:"custom_header_name,omitempty" yaml:"custom_header_name,omitempty"`

	// ProviderName identifies which upstream provider's tokens to retrieve for injection.
	// This is required and must match a configured upstream provider name.
	ProviderName string `json:"provider_name" yaml:"provider_name"`
}

Config holds configuration for upstream swap middleware.

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

Middleware wraps the upstream swap middleware functionality.

func (*Middleware) Close

func (*Middleware) Close() error

Close cleans up any resources used by the middleware.

func (*Middleware) Handler

func (m *Middleware) Handler() types.MiddlewareFunction

Handler returns the middleware function used by the proxy.

type MiddlewareParams

type MiddlewareParams struct {
	Config *Config `json:"config,omitempty"`
}

MiddlewareParams represents the JSON parameters for the middleware factory.

Jump to

Keyboard shortcuts

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