Documentation
¶
Overview ¶
Package compatibility isolates non-RFC 9421 HTTP authentication schemes behind caller-supplied protocol implementations. It does not parse, sign, verify, or reinterpret any legacy wire format itself. Start with an explicit New* adapter and trusted implementation/reporter; shared use requires safe synchronous collaborators. No server/client/worker lifecycle, protocol conformance, reporter-error redaction or automatic authorization is owned.
Index ¶
- Variables
- type ErrorReporter
- type Operation
- type Protocol
- type SigningRoundTripper
- func NewAWSSigV4SigningRoundTripper(config SigningRoundTripperConfig) (*SigningRoundTripper, error)
- func NewCavageSigningRoundTripper(config SigningRoundTripperConfig) (*SigningRoundTripper, error)
- func NewOAuth1SigningRoundTripper(config SigningRoundTripperConfig) (*SigningRoundTripper, error)
- func NewVendorSigningRoundTripper(name string, config SigningRoundTripperConfig) (*SigningRoundTripper, error)
- type SigningRoundTripperConfig
- type VerificationMiddleware
- func NewAWSSigV4VerificationMiddleware(config VerificationMiddlewareConfig) (VerificationMiddleware, error)
- func NewCavageVerificationMiddleware(config VerificationMiddlewareConfig) (VerificationMiddleware, error)
- func NewOAuth1VerificationMiddleware(config VerificationMiddlewareConfig) (VerificationMiddleware, error)
- func NewVendorVerificationMiddleware(name string, config VerificationMiddlewareConfig) (VerificationMiddleware, error)
- type VerificationMiddlewareConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAdapter reports incomplete or unsafe adapter configuration. ErrInvalidAdapter = errors.New("http signature compatibility: invalid adapter") // ErrSigning reports a sanitized external signing failure. ErrSigning = errors.New("http signature compatibility: signing failed") // ErrVerification reports a sanitized external verification failure. ErrVerification = errors.New("http signature compatibility: verification failed") )
Functions ¶
This section is empty.
Types ¶
type ErrorReporter ¶
ErrorReporter receives the original external implementation failure. It is an application-owned diagnostic boundary and must redact protocol secrets.
type Protocol ¶
type Protocol string
Protocol identifies a compatibility protocol that is deliberately separate from RFC 9421 fields and parsers.
type SigningRoundTripper ¶
type SigningRoundTripper struct {
// contains filtered or unexported fields
}
SigningRoundTripper applies one explicitly selected legacy or vendor signer to a cloned request before delegating it. It never invokes RFC 9421 parsers. Construct through an explicit New*SigningRoundTripper; zero is not usable. Shared calls require safe borrowed signer/transport/reporter implementations. Reporter panics/blocking are not contained and no client Close is owned.
func NewAWSSigV4SigningRoundTripper ¶
func NewAWSSigV4SigningRoundTripper(config SigningRoundTripperConfig) (*SigningRoundTripper, error)
NewAWSSigV4SigningRoundTripper creates an outbound AWS SigV4 boundary.
func NewCavageSigningRoundTripper ¶
func NewCavageSigningRoundTripper(config SigningRoundTripperConfig) (*SigningRoundTripper, error)
NewCavageSigningRoundTripper creates an outbound Cavage-draft boundary.
func NewOAuth1SigningRoundTripper ¶
func NewOAuth1SigningRoundTripper(config SigningRoundTripperConfig) (*SigningRoundTripper, error)
NewOAuth1SigningRoundTripper creates an outbound OAuth 1.0 boundary.
func NewVendorSigningRoundTripper ¶
func NewVendorSigningRoundTripper(name string, config SigningRoundTripperConfig) (*SigningRoundTripper, error)
NewVendorSigningRoundTripper creates an outbound boundary for one explicitly named vendor scheme. Names use lowercase Structured Field key characters.
func (*SigningRoundTripper) Protocol ¶
func (adapter *SigningRoundTripper) Protocol() Protocol
Protocol returns the explicitly selected compatibility protocol.
type SigningRoundTripperConfig ¶
type SigningRoundTripperConfig struct {
// Transport is mandatory borrowed transport; normal request-body ownership begins on
// delegation.
Transport http.RoundTripper
// Sign is mandatory caller-implemented protocol signing on an isolated
// metadata/body-denied view.
Sign func(context.Context, *http.Request) error
// ReportError is mandatory synchronous raw diagnostic handling; redact secrets and
// bound concurrency/blocking.
ReportError ErrorReporter
}
SigningRoundTripperConfig configures an outbound compatibility adapter. Sign receives an isolated request view. Protocol-specific header and trailer mutations are delegated, except Signature-Input, Signature, and Accept-Signature. Request identity mutations are discarded, and Body cannot be read or closed through the view. Body-derived form state, TLS, and redirect Response graphs are omitted because net/http clones can retain aliases.
type VerificationMiddleware ¶
VerificationMiddleware verifies one explicitly selected non-RFC protocol before invoking the next net/http handler.
func NewAWSSigV4VerificationMiddleware ¶
func NewAWSSigV4VerificationMiddleware(config VerificationMiddlewareConfig) (VerificationMiddleware, error)
NewAWSSigV4VerificationMiddleware creates an inbound AWS SigV4 boundary.
func NewCavageVerificationMiddleware ¶
func NewCavageVerificationMiddleware(config VerificationMiddlewareConfig) (VerificationMiddleware, error)
NewCavageVerificationMiddleware creates an inbound Cavage-draft boundary.
func NewOAuth1VerificationMiddleware ¶
func NewOAuth1VerificationMiddleware(config VerificationMiddlewareConfig) (VerificationMiddleware, error)
NewOAuth1VerificationMiddleware creates an inbound OAuth 1.0 boundary.
func NewVendorVerificationMiddleware ¶
func NewVendorVerificationMiddleware(name string, config VerificationMiddlewareConfig) (VerificationMiddleware, error)
NewVendorVerificationMiddleware creates an inbound boundary for one explicitly named vendor scheme.
type VerificationMiddlewareConfig ¶
type VerificationMiddlewareConfig struct {
// Verify is mandatory caller protocol verification on an isolated view; only its
// returned error communicates success.
Verify func(context.Context, *http.Request) error
// ReportError receives original external failure synchronously; caller owns
// redaction, concurrency and panic behavior.
ReportError ErrorReporter
// Reject is mandatory application response mapping for a sanitized ErrVerification;
// no status default is supplied.
Reject func(http.ResponseWriter, *http.Request, error)
}
VerificationMiddlewareConfig configures an inbound compatibility adapter. Verify receives an isolated request view whose mutations cannot reach later middleware. It communicates verification only through its returned error. Body, body-derived form state, TLS, and redirect Response graphs are omitted from the view. Reject receives only a sanitized error; ReportError is the separate application diagnostic seam.