diff --git a/server/config/settings/base.py b/server/config/settings/base.py index c19d9792..9efc8117 100644 --- a/server/config/settings/base.py +++ b/server/config/settings/base.py @@ -522,8 +522,8 @@ OAUTH = { "client_name": env("IT_OAUTH_CLIENT_NAME", default="lernetz"), "client_id": env("IT_OAUTH_CLIENT_ID", default="iterativ"), "client_secret": env("IT_OAUTH_CLIENT_SECRET", default=""), - "access_token_url": env("IT_OAUTH_ACCESS_TOKEN_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token"), - "authorize_url": env("IT_OAUTH_AUTHORIZE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/auth"), + # "access_token_url": env("IT_OAUTH_ACCESS_TOKEN_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token"), + # "authorize_url": env("IT_OAUTH_AUTHORIZE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/auth"), "authorize_params": IT_OAUTH_AUTHORIZE_PARAMS, "access_token_params": IT_OAUTH_AUTHORIZE_PARAMS, "api_base_url": env("IT_OAUTH_API_BASE_URL", default="https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/"), diff --git a/server/vbv_lernwelt/sso/urls.py b/server/vbv_lernwelt/sso/urls.py index 56785481..44f0d80e 100644 --- a/server/vbv_lernwelt/sso/urls.py +++ b/server/vbv_lernwelt/sso/urls.py @@ -7,4 +7,5 @@ app_name = 'sso' urlpatterns = [ path(r'login/', django_view_authentication_exempt(views.login), name='login'), path(r'callback/', django_view_authentication_exempt(views.authorize), name='authorize'), + path(r'foo/', django_view_authentication_exempt(views.foo), name='foo'), ] diff --git a/server/vbv_lernwelt/sso/views.py b/server/vbv_lernwelt/sso/views.py index 96298586..b3cb51c0 100644 --- a/server/vbv_lernwelt/sso/views.py +++ b/server/vbv_lernwelt/sso/views.py @@ -2,6 +2,7 @@ import structlog as structlog from authlib.integrations.base_client import OAuthError from django.conf import settings from django.shortcuts import redirect +from django.http import HttpResponse from sentry_sdk import capture_exception from django.contrib.auth import login as dj_login, get_user_model @@ -40,6 +41,10 @@ def authorize(request): return redirect(f'/{OAUTH_SUCCESS_REDIRECT}?state=success') # to be defined +def foo(request): + return HttpResponse(settings.OAUTH["server_metadata_url"]) + + def _user_data_from_token_data(token: dict) -> dict: return { "first_name": token.get("given_name", ""),