@@ -415,9 +415,10 @@ def test_do_end_session_request(self):
415415 alg = "RS256"
416416 ktyp = alg2keytype (alg )
417417 _sign_key = self .client .keyjar .get_signing_key (ktyp )
418+ id_token_jwt = IDTOKEN .to_jwt (key = _sign_key , algorithm = alg )
418419 args = {
419- "id_token " : IDTOKEN . to_jwt ( key = _sign_key , algorithm = alg ) ,
420- "redirect_url " : "http://example.com/end" ,
420+ "id_token_hint " : id_token_jwt ,
421+ "post_logout_redirect_uri " : "http://example.com/end" ,
421422 }
422423
423424 with responses .RequestsMock () as rsps :
@@ -427,10 +428,10 @@ def test_do_end_session_request(self):
427428 status = 302 ,
428429 headers = {"location" : "" },
429430 )
430- resp = self .client .do_end_session_request (request_args = args , state = "state1" )
431+ resp = self .client .do_end_session_request (request_args = args )
431432 parsed = parse_qs (urlparse (resp .request .url ).query )
432- assert parsed ["redirect_url " ] == ["http://example.com/end" ]
433- assert parsed ["id_token " ] is not None
433+ assert parsed ["post_logout_redirect_uri " ] == ["http://example.com/end" ]
434+ assert parsed ["id_token_hint " ] == [ id_token_jwt ]
434435
435436 def test_do_registration_request (self ):
436437 self .client .registration_endpoint = ( # type: ignore
@@ -681,9 +682,9 @@ def test_construct_EndSessionRequest_kwargs_state(self):
681682 self .client .grant ["foo" ].tokens .append (Token (resp ))
682683
683684 # state only in kwargs
684- args = {"redirect_url " : "http://example.com/end" }
685+ args = {"post_logout_redirect_uri " : "http://example.com/end" }
685686 esr = self .client .construct_EndSessionRequest (state = "foo" , request_args = args )
686- assert _eq (esr .keys (), ["id_token " , "redirect_url " ])
687+ assert _eq (esr .keys (), ["id_token_hint " , "post_logout_redirect_uri " ])
687688
688689 def test_construct_EndSessionRequest_reqargs_state (self ):
689690 self .client .grant ["foo" ] = Grant ()
@@ -708,9 +709,9 @@ def test_construct_EndSessionRequest_reqargs_state(self):
708709 self .client .grant ["foo" ].tokens .append (Token (resp ))
709710
710711 # state only in request_args
711- args = {"redirect_url " : "http://example.com/end" , "state" : "foo" }
712+ args = {"post_logout_redirect_uri " : "http://example.com/end" , "state" : "foo" }
712713 esr = self .client .construct_EndSessionRequest (request_args = args )
713- assert _eq (esr .keys (), ["id_token " , "state" , "redirect_url " ])
714+ assert _eq (esr .keys (), ["id_token_hint " , "state" , "post_logout_redirect_uri " ])
714715
715716 def test_construct_EndSessionRequest_kwargs_and_reqargs_state (self ):
716717 self .client .grant ["foo" ] = Grant ()
@@ -734,11 +735,29 @@ def test_construct_EndSessionRequest_kwargs_and_reqargs_state(self):
734735 self .client .grant ["foo" ].tokens .append (Token (resp ))
735736
736737 # state both in request_args and kwargs
737- args = {"redirect_url" : "http://example.com/end" , "state" : "req_args_state" }
738+ args = {
739+ "post_logout_redirect_uri" : "http://example.com/end" ,
740+ "state" : "req_args_state" ,
741+ }
738742 esr = self .client .construct_EndSessionRequest (state = "foo" , request_args = args )
739- assert _eq (esr .keys (), ["id_token " , "state" , "redirect_url " ])
743+ assert _eq (esr .keys (), ["id_token_hint " , "state" , "post_logout_redirect_uri " ])
740744 assert esr ["state" ] == "req_args_state"
741745
746+ def test_construct_EndSessionRequest_with_id_token_hint_and_post_logout_redirect_uri (
747+ self ,
748+ ):
749+ """Should construct end session request using id_token_hint and post_logout_redirect_uri"""
750+ self .client .keyjar .add_kb (IDTOKEN ["iss" ], KC_SYM_S )
751+ _sig_key = self .client .keyjar .get_signing_key ("oct" , IDTOKEN ["iss" ])
752+ _signed_jwt = IDTOKEN .to_jwt (_sig_key , algorithm = "HS256" )
753+
754+ args = {
755+ "post_logout_redirect_uri" : "http://example.com/end" ,
756+ "id_token_hint" : _signed_jwt ,
757+ }
758+ esr = self .client .construct_EndSessionRequest (request_args = args )
759+ assert _eq (esr .keys (), ["id_token_hint" , "post_logout_redirect_uri" ])
760+
742761 def test_construct_OpenIDRequest (self ):
743762 request_args = {"response_type" : "code id_token" , "state" : "af0ifjsldkj" }
744763
0 commit comments