45 $this->metadata = $metadatastore;
72 $responseroot = $responsedom->getElementsByTagName(
'Response')->item(0);
73 $firstassertionroot = $responsedom->getElementsByTagName(
'Assertion')->item(0);
81 if (
$spmd->hasValue(
'signresponse')) {
82 $signResponse =
$spmd->getBoolean(
'signresponse');
84 $signResponse = $this->configuration->getBoolean(
'shib13.signresponse',
true);
88 if ($firstassertionroot ===
null) {
92 $signer =
new Signer(array(
93 'privatekey_array' => $privatekey,
94 'publickey_array' => $publickey,
95 'id' => ($signResponse ?
'ResponseID' :
'AssertionID'),
98 if (
$idpmd->hasValue(
'certificatechain')) {
99 $signer->addCertificate(
$idpmd->getString(
'certificatechain'));
105 $statusElements = XML::getDOMChildren($responseroot,
'Status',
'@saml1p');
106 assert(count($statusElements) === 1);
107 $signer->sign($responseroot, $responseroot, $statusElements[0]);
110 $signer->sign($firstassertionroot, $firstassertionroot);
119 'SAMLResponse' => base64_encode(
$response),
133 assert(is_array(
$post));
135 if (!array_key_exists(
'SAMLResponse',
$post)) {
136 throw new \Exception(
'Missing required SAMLResponse parameter.');
138 $rawResponse =
$post[
'SAMLResponse'];
139 $samlResponseXML = base64_decode($rawResponse);
146 $samlResponse->setXML($samlResponseXML);
148 if (array_key_exists(
'TARGET',
$post)) {
149 $samlResponse->setRelayState(
$post[
'TARGET']);
152 return $samlResponse;
An exception for terminatinating execution or to throw for unit testing.
__construct(\SimpleSAML_Configuration $configuration, \SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore)
Constructor for the \SimpleSAML\Bindings\Shib13\HTTPPost class.
decodeResponse($post)
Decode a received response.
sendResponse( $response, \SimpleSAML_Configuration $idpmd, \SimpleSAML_Configuration $spmd, $relayState, $shire)
Send an authenticationResponse using HTTP-POST.
static loadPublicKey(\SimpleSAML_Configuration $metadata, $required=false, $prefix='')
Get public key or certificate from metadata.
static loadPrivateKey(\SimpleSAML_Configuration $metadata, $required=false, $prefix='', $full_path=false)
Load a private key from metadata.
static submitPOSTData($destination, $data)
Submit a POST form to a specific destination.
static checkSAMLMessage($message, $type)
This function performs some sanity checks on XML documents, and optionally validates them against the...
static debugSAMLMessage($message, $type)
Helper function to log SAML messages that we send or receive.