function sendQuery($dataId, $url, $nameId) { assert('is_string($dataId)'); assert('is_string($url)'); assert('is_array($nameId)'); SimpleSAML_Logger::debug('attributequery - sending request'); $query = new SAML2_AttributeQuery(); $query->setRelayState($dataId); $query->setDestination($url); $query->setIssuer($GLOBALS['spEntityId']); $query->setNameId($nameId); $binding = new SAML2_HTTPRedirect(); $binding->send($query); }
/** * build and send AttributeQuery */ function sendQuery($dataId, $url, $nameId, $attributes, $attributeNameFormat, $src, $dst) { assert('is_string($dataId)'); assert('is_string($url)'); assert('is_array($nameId)'); assert('is_array($attributes)'); SimpleSAML_Logger::debug('[attributeaggregator] - sending request'); $query = new SAML2_AttributeQuery(); $query->setRelayState($dataId); $query->setDestination($url); $query->setIssuer($src->getValue('entityid')); $query->setNameId($nameId); $query->setAttributeNameFormat($attributeNameFormat); if (!empty($attributes)) { $query->setAttributes($attributes); } sspmod_saml_Message::addSign($src, $dst, $query); if (!$query->getSignatureKey()) { throw new SimpleSAML_Error_Exception('[attributeaggregator] - Unable to find private key for signing attribute request.'); } SimpleSAML_Logger::debug('[attributeaggregator] - sending attribute query: ' . var_export($query, 1)); $binding = new SAML2_SOAPClient(); $result = $binding->send($query, $src); return $result; }