Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mozilla_django_oidc/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,13 @@ def process_request(self, request):
LOGGER.debug("request is not refreshable")
return

expiration = request.session.get("oidc_id_token_expiration", 0)
now = time.time()

if hasattr(request, 'headers') and 'X-Refresh-OIDC-Token' in request.headers:
request.session['oidc_id_token_expiration'] = now

expiration = request.session.get("oidc_id_token_expiration", 0)

if expiration > now:
# The id_token is still valid, so we don't have to do anything.
LOGGER.debug("id token is still valid (%s > %s)", expiration, now)
Expand Down