@@ -870,6 +870,17 @@ public function backChannelLogout(string $providerIdentifier, string $logout_tok
870870 );
871871 }
872872
873+ try {
874+ $ discovery = $ this ->discoveryService ->obtainDiscovery ($ provider );
875+ } catch (\Exception $ e ) {
876+ $ this ->logger ->error ('Could not reach the provider at URL ' . $ provider ->getDiscoveryEndpoint (), ['exception ' => $ e ]);
877+ return $ this ->getBackchannelLogoutErrorResponse (
878+ 'could not reach provider endpoint ' ,
879+ 'URL: ' . $ provider ->getDiscoveryEndpoint () . 'was not reachable ' ,
880+ true
881+ );
882+ }
883+
873884 // decrypt the logout token
874885 $ jwks = $ this ->discoveryService ->obtainJWK ($ provider , $ logout_token );
875886 JWT ::$ leeway = 60 ;
@@ -913,9 +924,24 @@ public function backChannelLogout(string $providerIdentifier, string $logout_tok
913924 'The logout token should contain an iss attribute ' ,
914925 true
915926 );
927+ } elseif ($ iss !== $ discovery ['issuer ' ]) {
928+ return $ this ->getBackchannelLogoutErrorResponse (
929+ 'invalid iss ' ,
930+ 'The iss of the logout token does not match the issuer ' ,
931+ false
932+ );
916933 }
917934 $ iss = $ logoutTokenPayload ->iss ;
918935
936+ if (!isset ($ logoutTokenPayload ->exp ) || $ logoutTokenPayload ->exp < $ this ->timeFactory ->getTime ()) {
937+ $ this ->logger ->debug ('Logout token expired ' );
938+ return $ this ->getBackchannelLogoutErrorResponse (
939+ 'invalid exp ' ,
940+ 'The logout token is expired ' ,
941+ true
942+ );
943+ }
944+
919945 if (!isset ($ logoutTokenPayload ->sid ) && !isset ($ logoutTokenPayload ->sub )) {
920946 return $ this ->getBackchannelLogoutErrorResponse (
921947 'invalid sid+sub ' ,
0 commit comments