Skip to content

feat: allow to configure JWT leeway in open_id_connect and increase default to 1 second #1031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions social_core/backends/open_id_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class OpenIdConnectAuth(BaseOAuth2):
USERNAME_KEY = "preferred_username"
JWT_ALGORITHMS = ["RS256"]
JWT_DECODE_OPTIONS = {}
JWT_LEEWAY = 1.0 # seconds
# When these options are unspecified, server will choose via openid autoconfiguration
ID_TOKEN_ISSUER = ""
ACCESS_TOKEN_URL = ""
Expand Down Expand Up @@ -222,6 +223,7 @@ def validate_and_return_id_token(self, id_token, access_token):
audience=client_id,
issuer=self.id_token_issuer(),
options=self.setting("JWT_DECODE_OPTIONS", self.JWT_DECODE_OPTIONS),
leeway=self.setting("JWT_LEEWAY", self.JWT_LEEWAY),
)
except ExpiredSignatureError:
raise AuthTokenError(self, "Signature has expired")
Expand Down