61 $this->server =
$config->getString(
'server');
62 $this->key =
$config->getString(
'key');
63 $this->cookieLifetime =
$config->getInteger(
'cookie.lifetime', 0);
65 if ($this->key ===
'ExampleSharedKey') {
98 if (
$response[
'domain'] !== $this->domain) {
121 $server->validate(
'CDCRequest');
143 $return = (string)
$request[
'return'];
186 $entityID = (string)
$request[
'entityID'];
190 $prevIndex = array_search($entityID,
$list,
true);
191 if ($prevIndex !==
false) {
192 unset(
$list[$prevIndex]);
212 'domain' =>
'.' . $this->domain,
245 private static function get($parameter)
247 assert(is_string($parameter));
249 if (!isset($_REQUEST[$parameter])) {
252 $message = (string)$_REQUEST[$parameter];
264 if (!isset(
$message[
'timestamp'])) {
293 assert(is_string($parameter));
294 assert(isset($_REQUEST[$parameter]));
296 $message = (string)$_REQUEST[$parameter];
298 if (!isset($_REQUEST[
'Signature'])) {
301 $signature = (string)$_REQUEST[
'Signature'];
304 if ($signature !== $cSignature) {
319 assert(is_string($to));
320 assert(is_string($parameter));
330 'Signature' => $signature,
333 $url = \SimpleSAML\Utils\HTTP::addURLParameters($to,
$params);
334 if (strlen(
$url) < 2048) {
350 assert(is_string($rawMessage));
352 return sha1($this->key . $rawMessage . $this->key);
363 if (!isset(
$_COOKIE[
'_saml_idp'])) {
371 if (
$idp ===
false) {
390 foreach (
$list as &$value) {
391 $value = base64_encode($value);
394 $cookie = implode(
' ',
$list);
396 while (strlen($cookie) > 4000) {
398 $tmp = explode(
' ', $cookie, 2);
399 if (count($tmp) === 1) {
410 'lifetime' => $this->cookieLifetime,
412 'domain' =>
'.' . $this->domain,
foreach($paths as $path) $request
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
static submitPOSTData($destination, $data)
Submit a POST form to a specific destination.
static setCookie($name, $value, $params=null, $throw=true)
Set a cookie.
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
getCDC()
Get the IdP entities saved in the common domain cookie.
__construct($domain)
Initialize a CDC server.
getResponse()
Parse and validate response received from a CDC server.
static get($parameter)
Helper function for parsing and validating a CDC message.
handleAppend(array $request)
Handle an append request.
send($to, $parameter, array $message)
Helper function for sending CDC messages.
$cookieLifetime
The lifetime of our cookie, in seconds.
sendRequest(array $request)
Send a request to this CDC server.
validate($parameter)
Helper function for validating the signature on a CDC message.
handleRequest(array $request)
Handle a parsed CDC requst.
setCDC(array $list)
Build a CDC cookie string.
calcSignature($rawMessage)
Calculate the signature on the given message.
static processRequest()
Parse and process a CDC request.
handleRead(array $request)
Handle a read request.
handleDelete(array $request)
Handle a delete request.
catch(Exception $e) $message
if(isset($_REQUEST['delete'])) $list