Skip to content

Commit

Permalink
use own url names instead of library
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed May 13, 2024
1 parent 59b5eb4 commit 27e4c69
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/digid_eherkenning_oidc_generics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def lookup_config(request: HttpRequest) -> type[OpenIDConnectBaseConfig]:
# config query param is set in `OIDCInit.get_extra_params`
try:
config = apps.get_model(request.GET.get("config", ""))
except LookupError as exc:
except (LookupError, ValueError) as exc:
raise BadRequest("Could not look up the referenced config.") from exc

# TODO: check if this can be spoofed: starting the flow with a particular config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_redirect_to_digid_oidc(self):
self.assertEqual(query_params["client_id"], "testclient")
self.assertEqual(
query_params["redirect_uri"],
f"http://testserver{reverse('digid_oidc:oidc_authentication_callback')}",
f"http://testserver{reverse('digid_oidc:callback')}",
)

with self.subTest("Return state setup"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_redirect_to_digid_machtigen_oidc(self):
self.assertEqual(query_params["client_id"], "testclient")
self.assertEqual(
query_params["redirect_uri"],
f"http://testserver{reverse('digid_machtigen_oidc:oidc_authentication_callback')}",
f"http://testserver{reverse('digid_machtigen_oidc:callback')}",
)

with self.subTest("Return state setup"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_redirect_to_eherkenning_oidc(self):
self.assertEqual(query_params["client_id"], "testclient")
self.assertEqual(
query_params["redirect_uri"],
f"http://testserver{reverse('eherkenning_oidc:oidc_authentication_callback')}",
f"http://testserver{reverse('eherkenning_oidc:callback')}",
)

with self.subTest("Return state setup"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_redirect_to_eherkenning_bewindvoering_oidc(self):
self.assertEqual(query_params["client_id"], "testclient")
self.assertEqual(
query_params["redirect_uri"],
f"http://testserver{reverse('eherkenning_bewindvoering_oidc:oidc_authentication_callback')}",
f"http://testserver{reverse('eherkenning_bewindvoering_oidc:callback')}",
)

with self.subTest("Return state setup"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_redirect_to_org_oidc(self, *m):
self.assertEqual(query_params["client_id"], "testclient")
self.assertEqual(
query_params["redirect_uri"],
f"http://testserver{reverse('org-oidc:oidc_authentication_callback')}",
f"http://testserver{reverse('org-oidc:callback')}",
)

parsed = furl(self.client.session["oidc_login_next"])
Expand Down Expand Up @@ -251,7 +251,7 @@ def test_redirect_to_allowed_domain(self, *m):
self.assertEqual(query_params["client_id"], "testclient")
self.assertEqual(
query_params["redirect_uri"],
f"http://testserver{reverse('org-oidc:oidc_authentication_callback')}",
f"http://testserver{reverse('org-oidc:callback')}",
)

@override_settings(
Expand Down Expand Up @@ -346,7 +346,7 @@ def test_callback_url_creates_logged_in_django_user(
)

# go through mock OIDC
callback_url = reverse_plus("org-oidc:oidc_authentication_callback")
callback_url = reverse_plus("org-oidc:callback")

session = self.client.session
session["oidc_states"] = {"mock": {"nonce": "nonce"}}
Expand Down

0 comments on commit 27e4c69

Please sign in to comment.