Skip to content

Commit c2013e6

Browse files
committed
feat: allow to configure JWT leeway in open_id_connect
The default value defined in the jwt module is 0.
1 parent 3ac2daf commit c2013e6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

social_core/backends/open_id_connect.py

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class OpenIdConnectAuth(BaseOAuth2):
5454
USERNAME_KEY = "preferred_username"
5555
JWT_ALGORITHMS = ["RS256"]
5656
JWT_DECODE_OPTIONS = {}
57+
JWT_LEEWAY = 0 # seconds
5758
# When these options are unspecified, server will choose via openid autoconfiguration
5859
ID_TOKEN_ISSUER = ""
5960
ACCESS_TOKEN_URL = ""
@@ -222,6 +223,7 @@ def validate_and_return_id_token(self, id_token, access_token):
222223
audience=client_id,
223224
issuer=self.id_token_issuer(),
224225
options=self.setting("JWT_DECODE_OPTIONS", self.JWT_DECODE_OPTIONS),
226+
leeway=self.setting("JWT_LEEWAY", self.JWT_LEEWAY),
225227
)
226228
except ExpiredSignatureError:
227229
raise AuthTokenError(self, "Signature has expired")

0 commit comments

Comments
 (0)