Skip to content

Commit c1487eb

Browse files
authored
Update oauth2_validators.py
1 parent 0a5ffdb commit c1487eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,12 +867,16 @@ def get_id_token_dictionary(self, token, token_handler, request):
867867
claims = self.get_oidc_claims(token, token_handler, request)
868868

869869
expiration_time = timezone.now() + timedelta(seconds=oauth2_settings.ID_TOKEN_EXPIRE_SECONDS)
870+
if request.user.last_login:
871+
auth_time = int(dateformat.format(request.user.last_login, "U"))
872+
else:
873+
auth_time = int(timezone.now().timestamp())
870874
# Required ID Token claims
871875
claims.update(
872876
**{
873877
"iss": self.get_oidc_issuer_endpoint(request),
874878
"exp": int(dateformat.format(expiration_time, "U")),
875-
"auth_time": int(dateformat.format(request.user.last_login, "U")),
879+
"auth_time": auth_time,
876880
"jti": str(uuid.uuid4()),
877881
}
878882
)

0 commit comments

Comments
 (0)