Skip to content

Commit a031261

Browse files
authored
Make sure the check_authenticated_session method validates the token (#52)
* Update auth.py Make sure the check_authenticated_session method validates the token added import of TokenStatus
1 parent 07080bb commit a031261

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fastapi_msal/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from fastapi_msal.core import MSALClientConfig, OptStr
88
from fastapi_msal.models import AuthToken, BearerToken, IDTokenClaims
99
from fastapi_msal.security import MSALAuthCodeHandler, MSALScheme
10+
from fastapi_msal.models.id_token_claims import TokenStatus
1011

1112

1213
class MSALAuthorization:
@@ -92,7 +93,7 @@ async def check_authenticated_session(self, request: Request) -> bool:
9293
auth_token: Optional[AuthToken] = await self.get_session_token(request)
9394
if auth_token:
9495
token_claims: Optional[IDTokenClaims] = await self.handler.parse_id_token(token=auth_token)
95-
if token_claims and token_claims.validate_token():
96+
if token_claims and token_claims.validate_token() == TokenStatus.VALID:
9697
return True
9798
return False
9899

0 commit comments

Comments
 (0)