Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1553 +/- ##
==========================================
+ Coverage 78.98% 79.01% +0.03%
==========================================
Files 354 354
Lines 11523 11605 +82
Branches 526 534 +8
==========================================
+ Hits 9101 9170 +69
- Misses 2241 2250 +9
- Partials 181 185 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR implements support for Azure AD (Entra ID) Federated Identity Credentials, allowing applications to authenticate using OIDC tokens from external identity providers instead of client secrets. This is particularly useful for Kubernetes workloads using service account tokens.
Changes:
- Added
client_assertionsupport to AzureAD OAuth2 backend as an alternative to client secrets - Modified token request methods to use client assertions when secrets are not configured
- Added comprehensive test coverage for federated identity credential authentication flows
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| social_core/backends/azuread.py | Implements client assertion authentication logic with fallback to environment variables and file-based tokens |
| social_core/tests/backends/test_azuread.py | Adds test classes covering FIC authentication, assertion validation, and missing credentials scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
renames to 'AzureADOAuth2FederatedIdentityCredentialTest' for better clarit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Renames token filename to 'OAUTH2_FEDERATED_TOKEN_FILE' for consistency with 'AZURE_FEDERATED_TOKEN_FILE'. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
| handle = tempfile.NamedTemporaryFile("w", delete=False) | ||
| handle.write(value) | ||
| handle.close() | ||
| self.addCleanup(os.remove, handle.name) | ||
| return handle.name |
There was a problem hiding this comment.
This IMHO could use context manager:
| handle = tempfile.NamedTemporaryFile("w", delete=False) | |
| handle.write(value) | |
| handle.close() | |
| self.addCleanup(os.remove, handle.name) | |
| return handle.name | |
| with tempfile.NamedTemporaryFile("w", delete=False) as handle: | |
| handle.write(value) | |
| self.addCleanup(os.remove, handle.name) | |
| return handle.name |
Azure AD (Entra ID) Federated Identity Credentials
Implements federated identity credentials so an external IdP’s OIDC-issued tokens can be trusted by a Microsoft Entra ID app. A common use case is an OIDC-enabled Kubernetes workload: the cluster issues a service account token and publishes OIDC metadata; the app registration is configured with a federated credential, allowing that token to authenticate without a client secret.
Links:
https://learn.microsoft.com/en-us/graph/api/resources/federatedidentitycredentials-overview
https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-create-trust
https://azure.github.io/azure-workload-identity/docs/topics/federated-identity-credential.html