|
7 | 7 | * @package SimpleSAMLphp |
8 | 8 | */ |
9 | 9 |
|
| 10 | +function handleStatusResponse($exception, $selfserviceurl) |
| 11 | +{ |
| 12 | + // the status of the response wasn't "success" |
| 13 | + SimpleSAML\Logger::debug('SFO - status response received, showing error page.'); |
| 14 | + $config = SimpleSAML_Configuration::getInstance(); |
| 15 | + |
| 16 | + $t = new SimpleSAML_XHTML_Template($config, 'stepupsfo:handlestatus.php'); |
| 17 | + $t->data['status'] = $exception->getStatus(); |
| 18 | + $t->data['subStatus'] = $exception->getSubStatus(); |
| 19 | + $t->data['statusMessage'] = $exception->getStatusMessage(); |
| 20 | + $t->data['selfserviceUrl'] = $selfserviceurl; |
| 21 | + $t->show(); |
| 22 | + exit(); |
| 23 | +} |
| 24 | + |
10 | 25 | SimpleSAML\Logger::debug('SFO - receiving response'); |
11 | 26 |
|
12 | 27 | $b = \SAML2\Binding::getCurrentBinding(); |
|
54 | 69 | try { |
55 | 70 | $assertions = sspmod_saml_Message::processResponse($spMetadata, $idpMetadata, $response); |
56 | 71 | } catch (sspmod_saml_Error $e) { |
57 | | - // the status of the response wasn't "success" |
58 | | - SimpleSAML\Logger::debug('SFO - status response received, showing error page.'); |
59 | | - $config = SimpleSAML_Configuration::getInstance(); |
60 | | - |
61 | | - $t = new SimpleSAML_XHTML_Template($config, 'stepupsfo:handlestatus.php'); |
62 | | - $t->data['status'] = $e->getStatus(); |
63 | | - $t->data['subStatus'] = $e->getSubStatus(); |
64 | | - $t->data['statusMessage'] = $e->getStatusMessage(); |
65 | | - $t->data['selfserviceUrl'] = $idpMetadata->getString('sfo:selfserviceUrl', ''); |
66 | | - $t->show(); |
67 | | - exit(); |
| 72 | + // the status of the response wasn't "success" (SSP < 1.17) |
| 73 | + handleStatusResponse($e, $idpMetadata->getString('sfo:selfserviceUrl', '')); |
| 74 | +} catch (SimpleSAML\Module\saml\Error $e) { |
| 75 | + // the status of the response wasn't "success" (SSP >= 1.17) |
| 76 | + handleStatusResponse($e, $idpMetadata->getString('sfo:selfserviceUrl', '')); |
68 | 77 | } |
69 | 78 |
|
70 | 79 | SimpleSAML\Logger::debug('SFO - successful response received, resume processing'); |
|
0 commit comments