@@ -588,6 +588,38 @@ def test_setup_auth_invalid_scope(self):
588588 assert excp
589589 assert isinstance (excp , UnAuthorizedClientScope )
590590
591+ def test_setup_auth_invalid_scope_2 (self ):
592+ request = AuthorizationRequest (
593+ client_id = "client_id" ,
594+ redirect_uri = "https://rp.example.com/cb" ,
595+ response_type = ["id_token" ],
596+ state = "state" ,
597+ nonce = "nonce" ,
598+ scope = "openid THAT-BLOODY_SCOPE" ,
599+ )
600+ cinfo = {
601+ "client_id" : "client_id" ,
602+ "redirect_uris" : [("https://rp.example.com/cb" , {})],
603+ "id_token_signed_response_alg" : "RS256" ,
604+ "allowed_scopes" : ["openid" , "profile" , "email" , "address" , "phone" , "offline_access" ],
605+ "deny_unknown_scopes" : True
606+ }
607+
608+ _context = self .endpoint .upstream_get ("context" )
609+ _context .cdb ["client_id" ] = cinfo
610+
611+ kaka = _context .cookie_handler .make_cookie_content ("value" , "sso" )
612+
613+ # force to 400 Http Error message if the release scope policy is heavy!
614+ _context .set_preference ("deny_unknown_scopes" , False )
615+ excp = None
616+ try :
617+ res = self .endpoint .process_request (request , http_info = {"headers" : {"cookie" : [kaka ]}})
618+ except UnAuthorizedClientScope as e :
619+ excp = e
620+ assert excp
621+ assert isinstance (excp , UnAuthorizedClientScope )
622+
591623 def test_setup_auth_user (self ):
592624 request = AuthorizationRequest (
593625 client_id = "client_id" ,
0 commit comments