Fix missing client_id during logout

This commit is contained in:
Seamus Johnston 2022-10-24 16:52:34 -05:00
parent 6880684dd6
commit 94800bc00a
No known key found for this signature in database
GPG key ID: 2F21225985069105
2 changed files with 3 additions and 4 deletions

View file

@ -81,7 +81,6 @@ class ViewsTest(TestCase):
def test_logout_redirect_url(self, mock_client): def test_logout_redirect_url(self, mock_client):
# setup # setup
session = self.client.session session = self.client.session
session["id_token_raw"] = "TEST" # nosec B105
session["state"] = "TEST" # nosec B105 session["state"] = "TEST" # nosec B105
session.save() session.save()
# mock # mock
@ -92,12 +91,13 @@ class ViewsTest(TestCase):
mock_client.provider_info = { mock_client.provider_info = {
"end_session_endpoint": "http://example.com/log_me_out" "end_session_endpoint": "http://example.com/log_me_out"
} }
mock_client.client_id = "TEST"
# test # test
with less_console_noise(): with less_console_noise():
response = self.client.get(reverse("logout")) response = self.client.get(reverse("logout"))
# assert # assert
expected = ( expected = (
"http://example.com/log_me_out?id_token_hint=TEST&state" "http://example.com/log_me_out?client_id=TEST&state"
"=TEST&post_logout_redirect_uri=http%3A%2F%2Fexample.com%2Fback" "=TEST&post_logout_redirect_uri=http%3A%2F%2Fexample.com%2Fback"
) )
actual = response.url actual = response.url

View file

@ -84,8 +84,7 @@ def logout(request, next_page=None):
try: try:
username = request.user.username username = request.user.username
request_args = { request_args = {
# it is perfectly fine to send the token, even if it is expired "client_id": CLIENT.client_id,
"id_token_hint": request.session["id_token_raw"],
"state": request.session["state"], "state": request.session["state"],
} }
if ( if (