fastapi-azure-auth icon indicating copy to clipboard operation
fastapi-azure-auth copied to clipboard

[Feature request] Provide option to configure the HTTPX AsyncClient

Open Kilo59 opened this issue 2 months ago • 2 comments

Describe the feature you'd like

I'd like to be able to customize the config for the HTTPX AsyncClient used to load the openid config (or any other HTTPX clients that are making external requests). https://github.com/intility/fastapi-azure-auth/blob/main/fastapi_azure_auth/openid_config.py#L75

I am in a locked down environment where I need to be able to set the a custom SSL cert. https://www.python-httpx.org/advanced/ssl/#working-with-ssl_cert_file-and-ssl_cert_dir

Additional context

My initial idea is to allow the OpenIdConfig class constructor to take parameter object that is then passed to the created AsyncClient.

Kilo59 avatar Nov 04 '25 15:11 Kilo59

It says

httpx does respect the SSL_CERT_FILE and SSL_CERT_DIR environment variables by default.

Wouldn't it be sufficient for you to set those env vars?

JonasKs avatar Nov 05 '25 05:11 JonasKs

It says

httpx does respect the SSL_CERT_FILE and SSL_CERT_DIR environment variables by default.

Wouldn't it be sufficient for you to set those env vars?

No it isn't. I need to be able to setup a custom SSL context. Furthermore, relying on ENV variables is always going to run into problems when you have several services that may need slightly different SSL Contexts.

Kilo59 avatar Nov 05 '25 14:11 Kilo59