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') {
78 assert(isset($request[
'return']));
79 assert(isset($request[
'op']));
82 $this->
send($this->server,
'CDCRequest', $request);
98 if (
$response[
'domain'] !== $this->domain) {
121 $server->validate(
'CDCRequest');
133 if (!isset($request[
'op'])) {
136 $op = (string)$request[
'op'];
140 if (!isset($request[
'return'])) {
143 $return = (string)$request[
'return'];
166 if (isset($request[
'id'])) {
167 $response[
'id'] = (string)$request[
'id'];
183 if (!isset($request[
'entityID'])) {
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));
322 $message[
'timestamp'] = time();
323 $message = json_encode($message);
324 $message = base64_encode($message);
329 $parameter => $message,
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'])) {
370 $idp = base64_decode($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,
if(isset($_REQUEST['delete'])) $list
$cookieLifetime
The lifetime of our cookie, in seconds.
foreach($paths as $path) $request
getCDC()
Get the IdP entities saved in the common domain cookie.
__construct($domain)
Initialize a CDC server.
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
handleDelete(array $request)
Handle a delete request.
getResponse()
Parse and validate response received from a CDC server.
calcSignature($rawMessage)
Calculate the signature on the given message.
catch(Exception $e) $message
static setCookie($name, $value, $params=null, $throw=true)
Set a cookie.
validate($parameter)
Helper function for validating the signature on a CDC message.
setCDC(array $list)
Build a CDC cookie string.
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
sendRequest(array $request)
Send a request to this CDC server.
static submitPOSTData($destination, $data)
Submit a POST form to a specific destination.
foreach($mandatory_scripts as $file) $timestamp
send($to, $parameter, array $message)
Helper function for sending CDC messages.
handleRead(array $request)
Handle a read request.
handleAppend(array $request)
Handle an append request.
static processRequest()
Parse and process a CDC request.
handleRequest(array $request)
Handle a parsed CDC requst.