Add SHA256 certificate thumbprint support with authority-based selection#873
Add SHA256 certificate thumbprint support with authority-based selection#873
Conversation
…lection Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
|
@copilot Ok. this is not good. Let's start over. Start by analyzing the tests for various types of authority. You should be able to identify examples for: adfs, ciam, b2c and a "generic' authority. Find these and show them to me |
I've analyzed the test files and found examples of each authority type: Authority Type Examples from Tests1. ADFS Authority
2. B2C Authority
3. CIAM Authority
4. Generic/Private Cloud Authority
5. AAD Authority (for reference)
Let me know what adjustments you'd like me to make based on these findings. |
|
@copilot For generic authority, see the public API oidc_authority. This represents a generic OIDC complain authority. Ok, so now you know all the authority types: adfs, b2c, ciam, oidc generic authority. Everything else is an AAD authority. Note that the library does not know all the authority hosts, i.e. clouds. You can only use the clasification above to know. Reimplement the solution using that clasification. Also try to reduce code duplication when it comes to authority types. |
- Add _is_oidc flag to Authority class to distinguish OIDC generic authorities - Simplify thumbprint selection logic: use SHA256 for all except ADFS and OIDC - Authority classification now: * ADFS: authority.is_adfs → SHA1 * B2C: authority._is_b2c (not OIDC) → SHA256 * CIAM: authority._is_b2c (not OIDC) → SHA256 * OIDC generic: authority._is_oidc → SHA1 * AAD: everything else → SHA256 - Update tests to reflect new classification - Add test for unknown AAD authority (sovereign cloud) Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
Reimplemented using the correct authority classification. Commit 0a8d2be. Authority Classification:
Changes:
|
|
@copilot There is one more authority - dSTS. Use SHA1 for that. |
- Update comments to explicitly mention dSTS as part of OIDC generic - Add test for dSTS authority to verify SHA1 is used - dSTS is already handled correctly as it's treated as OIDC authority - All 13 tests passing Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
Added dSTS support. Commit a9fb14e. dSTS is already handled correctly - it's automatically treated as an OIDC authority (path starts with Updated comments to explicitly mention dSTS and added test |
Adds
thumbprint_sha256parameter to enable modern SHA256 certificate authentication alongside legacy SHA1 support.Changes
Core Implementation (
msal/application.py,msal/authority.py)thumbprint_sha256inclient_credentialdictionary_is_oidcflag to Authority class to distinguish OIDC generic authorities from B2C/CIAMuse_sha256 = not authority.is_adfs and not is_oidcAuthority Classification
authority.is_adfs→ SHA1authority._is_b2c(not OIDC) → SHA256authority._is_b2c(not OIDC) → SHA256authority._is_oidc→ SHA1/dstsv2, treated as OIDC → SHA1Tests (
tests/test_optional_thumbprint.py)Usage
Backward compatible - existing
thumbprint(SHA1) usage unchanged.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.