Skip to content

Commit

Permalink
BB2-3497: fix auth version redirects (#1297)
Browse files Browse the repository at this point in the history
* Redirects all auth to v2 path.
Auth paths are the same, so v1 or v2 go to v2 callback moving forward. Prevents forking, v1->v2 is less confusing than v2->v1.

* deafult to v2

* Permission page fixed

* Fix test
  • Loading branch information
loganbertram authored Feb 26, 2025
1 parent 3d6a4bb commit 844c911
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions apps/dot_ext/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@


base_urlpatterns = [
path("authorize/", views.AuthorizationView.as_view(), name="authorize"),
path("authorize/", views.AuthorizationView.as_view(version=2), name="authorize"),
re_path(
r"^authorize/(?P<uuid>[\w-]+)/$",
views.ApprovalView.as_view(),
views.ApprovalView.as_view(version=2),
name="authorize-instance",
),
path("token/", views.TokenView.as_view(), name="token"),
Expand Down
2 changes: 1 addition & 1 deletion apps/mymedicare_cb/tests/test_callback_slsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def catchall(url, request):
self.assertIn("client_id=test", response.url)
self.assertIn("redirect_uri=test.com", response.url)
self.assertIn("response_type=token", response.url)
self.assertIn("http://www.google.com/v1/o/authorize/", response.url)
self.assertIn("http://www.google.com/v2/o/authorize/", response.url)
# assert login
self.assertNotIn("_auth_user_id", self.client.session)

Expand Down
2 changes: 1 addition & 1 deletion apps/mymedicare_cb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def authenticate(request):


@never_cache
def callback(request, version=1):
def callback(request, version=2):
try:
authenticate(request)
except ValidationError as e:
Expand Down
2 changes: 1 addition & 1 deletion apps/testclient/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_links(request, **kwargs):
if 'token' in request.session:
return render(request, HOME_PAGE,
context={"session_token": request.session['token'],
"api_ver": request.session.get('api_ver', 'v1')})
"api_ver": request.session.get('api_ver', 'v2')})
else:
return render(request, HOME_PAGE, context={"session_token": None})

Expand Down
6 changes: 3 additions & 3 deletions docker-compose/run_selenium_tests_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ export USE_NEW_PERM_SCREEN
export USE_MSLSX=false

# stop all before run selenium remote tests
docker-compose -f docker-compose.selenium.remote.yml down --remove-orphans
docker-compose -f docker-compose.selenium.remote.yml run selenium-remote-tests bash -c "SELENIUM_GRID=${SELENIUM_GRID} pytest ${PYTEST_SHOW_TRACE_OPT} ${TESTS_LIST}"
docker compose -f docker-compose.selenium.remote.yml down --remove-orphans
docker compose -f docker-compose.selenium.remote.yml run selenium-remote-tests bash -c "SELENIUM_GRID=${SELENIUM_GRID} pytest ${PYTEST_SHOW_TRACE_OPT} ${TESTS_LIST}"

# Stop containers after use
echo_msg
echo_msg "Stopping containers..."
echo_msg

docker-compose -f docker-compose.selenium.remote.yml stop
docker compose -f docker-compose.selenium.remote.yml stop

0 comments on commit 844c911

Please sign in to comment.