aeat.adapters.outbound.aeat.auth._certificate_backends._httpx_fallback module

Fail-closed httpx mTLS handshake backend.

The Python ssl API used by httpx requires certificate-chain material to be loaded from file paths. Writing decrypted PEM/key material to temporary files violates the secure-storage boundary, so this backend fails closed instead of materialising certificate secrets outside the encrypted backend.

CertificateBackend.HTTPX_FALLBACK remains available as a dispatch target so certificate health checks return a structured HandshakeResult instead of attempting an unsafe downgrade. Browser sessions should use PlaywrightContextBackend.

class HttpxFallbackBackend[source]

Bases: _CertBackend

mTLS handshake probe that fails closed under the secure-storage policy.

Verify-only backend; rejects any attempt to preload a browser context with AuthConfigurationError. See PlaywrightContextBackend for the interactive counterpart.

preload(cert, context)[source]

Reject the call — this backend cannot drive a browser context.

Parameters:
Raises:

AuthConfigurationError – Always.

Return type:

None

verify(cert, url)[source]

Return a closed failure without materialising PEM/key files.

httpx cannot consume in-memory PKCS#12 client certificates through Python’s standard ssl API, and converting the certificate and private key to plaintext temporary files is forbidden because certificate secrets must not bypass the secure-storage boundary. The fallback therefore reports a closed failure rather than degrading the secrecy contract.

Parameters:
  • cert (LoadedCertificate) – The loaded PKCS#12 certificate to present.

  • url (str) – HTTPS endpoint to probe.

Return type:

HandshakeResult

Returns:

A HandshakeResult describing the closed-failure outcome.