PHP Classes

File: web/SSO/modules/core/www/cleardiscochoices.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/core/www/cleardiscochoices.php   Download  
File: web/SSO/modules/core/www/cleardiscochoices.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 1,155 bytes
 

Contents

Class file image Download
<?php

require_once('_include.php');

/**
 * This page clears the user's IdP discovery choices.
 */

/* The base path for cookies. This should be the installation directory for simpleSAMLphp. */
$config = SimpleSAML_Configuration::getInstance();
$cookiePath = '/' . $config->getBaseUrl();

/* We delete all cookies which starts with 'idpdisco_' */
foreach($_COOKIE as $cookieName => $value) {
    if (
substr($cookieName, 0, 9) !== 'idpdisco_') {
       
/* Not a idpdisco cookie. */
       
continue;
    }

   
/* Delete the cookie. We delete it once without the secure flag and once with the secure flag. This
     * ensures that the cookie will be deleted in any case.
     */
   
SimpleSAML_Utilities::setCookie($cookieName, NULL, array('path' => $cookiePath, 'httponly' => FALSE), FALSE);
}


/* Find where we should go now. */
if(array_key_exists('ReturnTo', $_REQUEST)) {
   
$returnTo = SimpleSAML_Utilities::checkURLAllowed($_REQUEST['ReturnTo']);
} else {
   
/* Return to the front page if no other destination is given. This is the same as the base cookie path. */
   
$returnTo = $cookiePath;
}

/* Redirect to destination. */
SimpleSAML_Utilities::redirectTrustedURL($returnTo);