Skip to content

Commit

Permalink
Remove custom OIDC callback class
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceafill committed Oct 3, 2024
1 parent 70bb131 commit 1735764
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
1 change: 0 additions & 1 deletion storage_service/storage_service/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ def get_oidc_secondary_providers(oidc_secondary_provider_names):
OIDC_AUTHENTICATE_CLASS = (
"storage_service.views.CustomOIDCAuthenticationRequestView"
)
OIDC_CALLBACK_CLASS = "storage_service.views.CustomOIDCAuthenticationCallbackView"

AUTHENTICATION_BACKENDS += ["common.backends.CustomOIDCBackend"]
LOGIN_EXEMPT_URLS.append(r"^oidc")
Expand Down
40 changes: 0 additions & 40 deletions storage_service/storage_service/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.views.decorators.cache import cache_page
from django.views.decorators.http import last_modified
from django.views.i18n import JavaScriptCatalog
from mozilla_django_oidc.views import OIDCAuthenticationCallbackView
from mozilla_django_oidc.views import OIDCAuthenticationRequestView
from mozilla_django_oidc.views import OIDCLogoutView
from shibboleth.views import ShibbolethLogoutView
Expand All @@ -24,45 +23,6 @@ class CustomShibbolethLogoutView(ShibbolethLogoutView):
pass


class CustomOIDCAuthenticationCallbackView(OIDCAuthenticationCallbackView):
"""
OIDC client authentication callback HTTP endpoint
"""

def get_settings(self, attr, *args):
if attr in [
"OIDC_RP_CLIENT_ID",
"OIDC_RP_CLIENT_SECRET",
"OIDC_OP_AUTHORIZATION_ENDPOINT",
"OIDC_OP_TOKEN_ENDPOINT",
"OIDC_OP_USER_ENDPOINT",
"OIDC_OP_JWKS_ENDPOINT",
"OIDC_OP_LOGOUT_ENDPOINT",
]:
# Retrieve the request object stored in the instance.
request = getattr(self, "request", None)

if request:
provider_name = request.session.get("providername")

if (
provider_name
and provider_name in settings.OIDC_SECONDARY_PROVIDER_NAMES
):
provider_settings = settings.OIDC_PROVIDERS.get(provider_name, {})
value = provider_settings.get(attr)

if value is None:
raise ImproperlyConfigured(
f"Setting {attr} for provider {provider_name} not found"
)
return value

# If request is None or provider_name session var is not set or attr is
# not in the list, call the superclass's get_settings method.
return OIDCAuthenticationCallbackView.get_settings(attr, *args)


class CustomOIDCAuthenticationRequestView(OIDCAuthenticationRequestView):
"""
Provide OpenID Connect authentication
Expand Down

0 comments on commit 1735764

Please sign in to comment.