Skip to content
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

feature/1784 - Fix oidc callback redirect to go to login redirect as opposed to '/' which was previously redirecting to login #1230

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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: 1 addition & 1 deletion django-backend/fecfiler/oidc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def oidc_callback(request):
handle_oidc_callback_request(request)
return HttpResponseRedirect(LOGIN_REDIRECT_URL)
handle_oidc_callback_error(request)
return HttpResponseRedirect("/")
return HttpResponseRedirect(LOGIN_REDIRECT_CLIENT_URL)
except Exception as error:
logger.error(f"Failed to process oidc_callback request {str(error)}")
return HttpResponseServerError()
Expand Down
5 changes: 2 additions & 3 deletions django-backend/fecfiler/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from django.views.generic.base import RedirectView
from fecfiler.settings import LOGIN_REDIRECT_CLIENT_URL, MOCK_OIDC_PROVIDER
from fecfiler.settings import MOCK_OIDC_PROVIDER
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView

BASE_V1_URL = r"^api/v1/"
Expand Down Expand Up @@ -33,8 +33,7 @@ def get_api_status(_request):
re_path(BASE_V1_URL, include("fecfiler.feedback.urls")),
re_path(BASE_V1_URL, include("fecfiler.oidc.urls")),
re_path(BASE_V1_URL, include("fecfiler.cash_on_hand.urls")),
re_path(r"", include("fecfiler.devops.urls")),
path("", RedirectView.as_view(url=LOGIN_REDIRECT_CLIENT_URL)),
path("", RedirectView.as_view(url="/api/docs/")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need re_path(r"", include("fecfiler.devops.urls")),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this and got it ordered so path("") call comes before re_path("") call to prevent authentication issue with "" route.

re_path(BASE_V1_URL + "status/", get_api_status),
]

Expand Down