-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix SessionRefresh flow for new architecture
previously, the callback view never had access to the config class, because this is deleted after successful login by mozilla-django-oidc, causing the callbackview to crash
- Loading branch information
Showing
5 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ | |
} | ||
|
||
OPEN_ID_CONFIG_PATH = ".well-known/openid-configuration" | ||
|
||
CONFIG_CLASS_SESSION_KEY = "_OIDCDB_CONFIG_CLASS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.contrib.auth.signals import user_logged_in | ||
from django.dispatch import receiver | ||
|
||
from .constants import CONFIG_CLASS_SESSION_KEY | ||
|
||
|
||
@receiver([user_logged_in], dispatch_uid="oidcdb.set_config_class") | ||
def set_oidcdb_config_class_on_session(sender, user, request, **kwargs): | ||
""" | ||
Record the OIDC config class on the session, this is needed so the callback view | ||
can retrieve the config in case of a SessionRefresh flow | ||
""" | ||
if hasattr(user, "_oidcdb_config_class"): | ||
request.session[CONFIG_CLASS_SESSION_KEY] = user._oidcdb_config_class |