Skip to content

Commit dd43694

Browse files
CopilotbgavrilMS
andcommitted
Address code review feedback - clarify comments and simplify logic
Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
1 parent 77fdd50 commit dd43694

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

msal/application.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -851,9 +851,9 @@ def _build_client(self, client_credential, authority, skip_regional_client=False
851851
): # Then we treat the public_certificate value as PEM content
852852
headers["x5c"] = extract_certs(client_credential['public_certificate'])
853853
# Determine which thumbprint to use based on what's available and authority type
854-
# Spec: If both thumbprints are provided:
855-
# - Use SHA256 for AAD authorities (including B2C, CIAM)
856-
# - Use SHA1 for ADFS and generic authorities
854+
# Based on the feature requirement:
855+
# - If both thumbprints are provided, use SHA256 for AAD authorities
856+
# (including B2C, CIAM), and SHA1 for ADFS and generic authorities
857857
use_sha256 = False
858858
if sha256_thumbprint and sha1_thumbprint:
859859
# Both thumbprints provided - choose based on authority type
@@ -869,11 +869,9 @@ def _build_client(self, client_credential, authority, skip_regional_client=False
869869
elif sha256_thumbprint:
870870
# Only SHA256 provided
871871
use_sha256 = True
872-
elif sha1_thumbprint:
873-
# Only SHA1 provided
874-
use_sha256 = False
875872
else:
876-
raise ValueError("You must provide either 'thumbprint' (SHA-1) or 'thumbprint_sha256' (SHA-256).")
873+
# Only SHA1 provided or fallback
874+
use_sha256 = False
877875

878876
if use_sha256:
879877
assertion_params = {

0 commit comments

Comments
 (0)