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):
# setup
session = self.client.session
session["id_token_raw"] = "TEST" # nosec B105
session["state"] = "TEST" # nosec B105
session.save()
# mock
@ -92,12 +91,13 @@ class ViewsTest(TestCase):
mock_client.provider_info = {
"end_session_endpoint": "http://example.com/log_me_out"
}
mock_client.client_id = "TEST"
# test
with less_console_noise():
response = self.client.get(reverse("logout"))
# assert
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"
)
actual = response.url

View file

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