-
Notifications
You must be signed in to change notification settings - Fork 211
Add SHA256 certificate thumbprint support with authority-based selection #873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
55483b2
77fdd50
dd43694
ba84c3c
938db07
81240fb
0a8d2be
a9fb14e
40dfa91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -300,6 +300,10 @@ def __init__( | |||||||||||||||||||||||||||
| "Changed in version 1.35.0, if thumbprint is absent" | ||||||||||||||||||||||||||||
| "and a public_certificate is present, MSAL will" | ||||||||||||||||||||||||||||
| "automatically calculate an SHA-256 thumbprint instead.", | ||||||||||||||||||||||||||||
| "thumbprint_sha256": "An SHA-256 thumbprint (Added in version 1.35.0). " | ||||||||||||||||||||||||||||
|
Comment on lines
302
to
+303
|
||||||||||||||||||||||||||||
| "automatically calculate an SHA-256 thumbprint instead.", | |
| "thumbprint_sha256": "An SHA-256 thumbprint (Added in version 1.35.0). " | |
| "automatically calculate a SHA-256 thumbprint instead.", | |
| "thumbprint_sha256": "A SHA-256 thumbprint (Added in version 1.35.0). " |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline “Authority classification” comment block mentions B2C/CIAM detection via authority._is_b2c (and not OIDC), but the actual selection logic only keys off authority.is_adfs and authority._is_oidc. To avoid future confusion, consider updating the comment to match the implemented conditions (and explain that B2C/CIAM are implicitly covered by “not ADFS and not OIDC”).
| # Authority classification: | |
| # - ADFS: authority.is_adfs | |
| # - B2C: authority._is_b2c (and not OIDC) | |
| # - CIAM: authority._is_b2c (and not OIDC) | |
| # - OIDC generic: authority._is_oidc (includes dSTS) | |
| # - AAD: everything else | |
| # Use SHA256 for AAD, B2C, CIAM; use SHA1 for ADFS, OIDC generic, and dSTS | |
| # Authority classification (for thumbprint selection): | |
| # - ADFS: authority.is_adfs is True | |
| # - OIDC generic (including dSTS): authority._is_oidc is True | |
| # - AAD, B2C, CIAM, and other Azure clouds: neither authority.is_adfs nor authority._is_oidc is True | |
| # | |
| # Use SHA256 for AAD/B2C/CIAM-like authorities; use SHA1 for ADFS and OIDC generic (including dSTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client_credential docstring currently says that when thumbprint is absent and public_certificate is present, MSAL will automatically calculate a SHA-256 thumbprint instead. With the updated authority-based selection (e.g., ADFS/OIDC/dSTS falling back to SHA-1 when both thumbprints are available), this wording is misleading—please clarify that MSAL may calculate both SHA-1 and SHA-256 thumbprints from the certificate and then choose based on authority type.