Help us shape the future of Go! Take the 2026 Go Developer Survey

shared

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const BuiltInDefaultMode = ModeBearerFirst

Built-in default mode.

View Source
const (
	// BuiltInDefaultReuseAuthorizer controls behavior when no source (context/client/CLI/env/provider/global) sets reuse.
	// Set to false so reuse is disabled unless explicitly enabled.
	BuiltInDefaultReuseAuthorizer = false
)

Built-in defaults when nothing is configured.

Variables

This section is empty.

Functions

func ResolveReuseAuthorizer

func ResolveReuseAuthorizer(in ReuseAuthorizerResolutionInput) bool

ResolveReuseAuthorizer applies precedence to determine the effective setting. Precedence: context > client > CLI > env > provider > global > built-in.

func ReuseAuthorizerFromContext

func ReuseAuthorizerFromContext(ctx context.Context) (*bool, bool)

ReuseAuthorizerFromContext returns the override if present.

func WithReuseAuthorizer

func WithReuseAuthorizer(ctx context.Context, v bool) context.Context

WithReuseAuthorizer sets a per-request override.

func WithReuseAuthorizerMode

func WithReuseAuthorizerMode(ctx context.Context, m Mode) context.Context

WithReuseAuthorizerMode sets a per-request mode override.

Types

type Mode

type Mode string

Mode represents how to apply reused auth to MCP requests.

const (
	ModeBearerFirst Mode = "bearer_first"
	ModeCookieFirst Mode = "cookie_first"
)

func ResolveReuseAuthorizerMode

func ResolveReuseAuthorizerMode(in ReuseModeResolutionInput) Mode

ResolveReuseAuthorizerMode resolves the mode with precedence and normalization. Precedence: context > client > CLI > env > provider > global > built-in.

func ReuseAuthorizerModeFromContext

func ReuseAuthorizerModeFromContext(ctx context.Context) (*Mode, bool)

ReuseAuthorizerModeFromContext returns the mode override if present.

type ReuseAuthorizerResolutionInput

type ReuseAuthorizerResolutionInput struct {
	Ctx         context.Context
	ClientOpt   *bool // MCPReuseAuthorizer pointer; nil if unspecified
	CLIOpt      *bool // CLI flag override; nil if unspecified
	EnvOpt      *bool // Env var override; nil if unspecified
	ProviderOpt *bool // Provider config; nil if unspecified
	GlobalOpt   *bool // Global config default; nil if unspecified
}

ReuseAuthorizerResolutionInput aggregates potential sources for the setting.

type ReuseModeResolutionInput

type ReuseModeResolutionInput struct {
	Ctx         context.Context
	ClientOpt   *string // MCPReuseAuthorizerMode pointer; nil if unspecified
	CLIOpt      *string // CLI flag override; nil if unspecified
	EnvOpt      *string // Env var override; nil if unspecified
	ProviderOpt *string // Provider config; nil if unspecified
	GlobalOpt   *string // Global config default; nil if unspecified
}

ReuseModeResolutionInput aggregates potential sources for the mode.

Jump to

Keyboard shortcuts

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