56        $this->cdcDomain = $this->discoconfig->getString(
'cdc.domain', 
null);
 
   57        if ($this->cdcDomain !== 
null && $this->cdcDomain[0] !== 
'.') {
 
   59            $this->cdcDomain = 
'.'.$this->cdcDomain;
 
   62        $this->cdcLifetime = $this->discoconfig->getInteger(
'cdc.lifetime', 
null);
 
   90    public static function mcmp(array $a, array $b)
 
   92        if (isset($a[
'name'][
'en']) && isset($b[
'name'][
'en'])) {
 
   93            return strcasecmp($a[
'name'][
'en'], $b[
'name'][
'en']);
 
   94        } elseif (isset($a[
'name'][
'en'])) {
 
   96        } elseif (isset($b[
'name'][
'en'])) {
 
   99            return strcasecmp($a[
'entityid'], $b[
'entityid']);
 
  115        $order = $this->discoconfig->getValue(
'taborder');
 
  116        if (is_array($order)) {
 
  117            foreach ($order as $oe) {
 
  122        $enableTabs = $this->discoconfig->getValue(
'tabs', 
null);
 
  125            $tags = array(
'misc');
 
  126            if (array_key_exists(
'tags', $val)) {
 
  127                $tags = $val[
'tags'];
 
  130                if (!empty($enableTabs) && !in_array(
$tag, $enableTabs, 
true)) {
 
  138            uasort(
$slist[
$tab], array(
'sspmod_discopower_PowerIdPDisco', 
'mcmp'));
 
  156        if (in_array($entry[
'entityid'], $filter[
'entities.include'], 
true)) {
 
  159        if (in_array($entry[
'entityid'], $filter[
'entities.exclude'], 
true)) {
 
  163        if (array_key_exists(
'tags', $entry)) {
 
  164            foreach ($filter[
'tags.include'] as $fe) {
 
  165                if (in_array($fe, $entry[
'tags'], 
true)) {
 
  169            foreach ($filter[
'tags.exclude'] as $fe) {
 
  170                if (in_array($fe, $entry[
'tags'], 
true)) {
 
  192            $spmd = $this->metadata->getMetaData($this->spEntityId, 
'saml20-sp-remote');
 
  193        } 
catch (Exception $e) {
 
  200        if (!array_key_exists(
'discopower.filter', 
$spmd)) {
 
  203        $filter = 
$spmd[
'discopower.filter'];
 
  205        if (!array_key_exists(
'entities.include', $filter)) {
 
  206            $filter[
'entities.include'] = array();
 
  208        if (!array_key_exists(
'entities.exclude', $filter)) {
 
  209            $filter[
'entities.exclude'] = array();
 
  211        if (!array_key_exists(
'tags.include', $filter)) {
 
  212            $filter[
'tags.include'] = array();
 
  214        if (!array_key_exists(
'tags.exclude', $filter)) {
 
  215            $filter[
'tags.exclude'] = array();
 
  219        if (array_key_exists(
'entities.include', 
$spmd[
'discopower.filter']) ||
 
  220            array_key_exists(
'tags.include', 
$spmd[
'discopower.filter'])
 
  223            $defaultrule = 
false;
 
  226        $returnlist = array();
 
  229                $returnlist[
$key] = $entry;
 
  251            if (!empty($preferredIdP) && array_key_exists($preferredIdP, 
$slist)) {
 
  252                $faventry = 
$slist[$preferredIdP];
 
  257        $discoPowerTabs = array(
 
  258            'denmark' => 
$t->noop(
'{discopower:tabs:denmark}'),
 
  259            'edugain' => 
$t->noop(
'{discopower:tabs:edugain}'),
 
  260            'finland' => 
$t->noop(
'{discopower:tabs:finland}'),
 
  261            'greece' => 
$t->noop(
'{discopower:tabs:greece}'),
 
  262            'southafrica' => 
$t->noop(
'{discopower:tabs:southafrica}'),
 
  263            'iceland' => 
$t->noop(
'{discopower:tabs:iceland}'),
 
  264            'incommon' => 
$t->noop(
'{discopower:tabs:incommon}'),
 
  265            'kalmar' => 
$t->noop(
'{discopower:tabs:kalmar}'),
 
  266            'misc' => 
$t->noop(
'{discopower:tabs:misc}'),
 
  267            'norway' => 
$t->noop(
'{discopower:tabs:norway}'),
 
  268            'sweden' => 
$t->noop(
'{discopower:tabs:sweden}'),
 
  269            'switzerland' => 
$t->noop(
'{discopower:tabs:switzerland}'),
 
  270            'ukacessfederation' => 
$t->noop(
'{discopower:tabs:ukacessfederation}'),
 
  272        $t->data[
'faventry'] = $faventry;
 
  273        $t->data[
'tabNames'] = $discoPowerTabs;
 
  274        $t->data[
'idplist'] = $idpList;
 
  275        $t->data[
'preferredidp'] = $preferredIdP;
 
  279        $t->data[
'urlpattern'] = htmlspecialchars(\
SimpleSAML\Utils\HTTP::getSelfURLNoQuery());
 
  280        $t->data[
'rememberenabled'] = $this->config->getBoolean(
'idpdisco.enableremember', 
false);
 
  281        $t->data[
'rememberchecked'] = $this->config->getBoolean(
'idpdisco.rememberchecked', 
false);
 
  282        $t->data[
'defaulttab'] = $this->discoconfig->getValue(
'defaulttab', 0);
 
  283        $t->data[
'score'] = $this->discoconfig->getValue(
'score', 
'quicksilver');
 
  295        if (!isset(
$_COOKIE[
'_saml_idp'])) {
 
  303            if (
$idp === 
false) {
 
  322        assert(
'is_string($idp)');
 
  324        if ($this->cdcDomain === 
null) {
 
  325            parent::setPreviousIdP(
$idp);
 
  331        $prevIndex = array_search(
$idp, 
$list, 
true);
 
  332        if ($prevIndex !== 
false) {
 
  333            unset(
$list[$prevIndex]);
 
  337        foreach (
$list as &$value) {
 
  338            $value = base64_encode($value);
 
  340        $newCookie = implode(
' ', 
$list);
 
  342        while (strlen($newCookie) > 4000) {
 
  344            $tmp = explode(
' ', $newCookie, 2);
 
  345            if (count($tmp) === 1) {
 
  349            $newCookie = $tmp[1];
 
  353            'lifetime' => $this->cdcLifetime,
 
  354            'domain'   => $this->cdcDomain,
 
  371        if ($this->cdcDomain === 
null) {
 
  372            return parent::getPreviousIdP();
 
  375        $prevIdPs = $this->
getCDC();
 
  376        while (count($prevIdPs) > 0) {
 
  377            $idp = array_pop($prevIdPs);
 
An exception for terminatinating execution or to throw for unit testing.
static setCookie($name, $value, $params=null, $throw=true)
Set a cookie.
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
getIdPList()
Retrieve the list of IdPs which are stored in the metadata.
start()
Check if an IdP is set or if the request is passive, and redirect accordingly.
validateIdP($idp)
Validates the given IdP entity id.
getRecommendedIdP()
Try to determine which IdP the user should most likely use.
setPreviousIdP($idp)
Save the current IdP choice to a cookie.
static mcmp(array $a, array $b)
Compare two entities.
idplistStructured($list)
Structure the list of IdPs in a hierarchy based upon the tags.
processFilter($filter, $entry, $default=true)
Do the actual filtering according the rules defined.
filterList($list)
Filter a list of entities according to any filters defined in the parent class, plus discopower confi...
handleRequest()
Handles a request to this discovery service.
log($message)
Log a message.
getPreviousIdP()
Retrieve the previous IdP the user used.
getCDC()
Get the IdP entities saved in the common domain cookie.
__construct(array $metadataSets, $instance)
Initializes this discovery service.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
catch(Exception $e) $message
Attribute-related utility methods.
if(isset($_REQUEST['delete'])) $list