Skip to content

Commit f955c95

Browse files
committed
remove hasattr calls
1 parent 2deb5e0 commit f955c95

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

reflex_azure_auth/state.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ async def _validate_tokens(self, expiration_only: bool = False) -> bool:
8181

8282
# validate nonce
8383
try:
84-
if (
85-
hasattr(self, "_nonce")
86-
and id_claims.get("nonce")
87-
and id_claims.get("nonce") != self._nonce
88-
):
84+
nonce_claim = id_claims.get("nonce")
85+
if (self._nonce and nonce_claim) and nonce_claim != self._nonce:
8986
print("Nonce mismatch") # noqa: T201
9087
return False
9188
except Exception:
@@ -95,9 +92,7 @@ async def _validate_tokens(self, expiration_only: bool = False) -> bool:
9592
try:
9693
at_hash_claim = id_claims.get("at_hash")
9794
if (
98-
at_hash_claim
99-
and hasattr(self, "_expected_at_hash")
100-
and self._expected_at_hash
95+
self._expected_at_hash and at_hash_claim
10196
) and at_hash_claim != self._expected_at_hash:
10297
print("at_hash mismatch") # noqa: T201
10398
return False

0 commit comments

Comments
 (0)