Describe the bug
The application crashes with a 500 Internal Server Error when configured with OIDC Authentication with Azure Active Directory as a Single-Tenant Application in Azure AD.
The application fails to verify the Azure id_token signature because the signing key (kid) is missing from the local KeyJar. This occurs because Azure signs the token with a specific key that is only exposed on the App-Specific JWKS endpoint, but the application's auto-discovery only queries the generic tenant endpoint.
Source:
To Reproduce
Steps to reproduce the behavior:
- Configuration: Configure the application as a Single-Tenant App
- User Action: Go to the login page and authenticate using a user account that triggers Azure's consumer signing flow
- Observation: The login fails after redirect.
- See error: 500 Internal Server Error caused by jwkest.jws.NoSuitableSigningKeys.
Expected behavior
The application should successfully validate the token signature for all valid users with Single-Tenant apps and Multitenant applications.
Screenshots
Traceback (most recent call last):
File "/opt/venv/lib/python3.9/site-packages/oic/oic/message.py", line 312, in verify_id_token
idt = IdToken().from_jwt(_jws, **args)
File "/opt/venv/lib/python3.9/site-packages/jwkest/jws.py", line 564, in verify_compact_verbose
raise NoSuitableSigningKeys(
jwkest.jws.NoSuitableSigningKeys: No key with kid: xxx-XXXXXXXXX
Additional context
- Updated app/config.py to load OIDC_JWKS_URI.
- Updated oidc_handler.py to prioritize manual JWKS URI.
Describe the bug
The application crashes with a 500 Internal Server Error when configured with OIDC Authentication with Azure Active Directory as a Single-Tenant Application in Azure AD.
The application fails to verify the Azure id_token signature because the signing key (kid) is missing from the local KeyJar. This occurs because Azure signs the token with a specific key that is only exposed on the App-Specific JWKS endpoint, but the application's auto-discovery only queries the generic tenant endpoint.
Source:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The application should successfully validate the token signature for all valid users with Single-Tenant apps and Multitenant applications.
Screenshots
Additional context