Skip to content
Snippets Groups Projects
Commit fc40a829 authored by Lasse Birnbaum Jensen's avatar Lasse Birnbaum Jensen
Browse files

Added option for 2 possible layouts of the idpdisco. The current link-list and...

Added option for 2 possible layouts of the idpdisco. The current link-list and the new dropdown box. Layout is choosen in the config.php.

Added cookie support for prefered choice of idp.

My 1st commit to simpleSAMLphp



git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@161 44740490-163a-0410-bde0-09ae8108e29a
parent 60f4dddc
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,21 @@ $config = array (
'default-saml20-idp' => 'max.feide.no',
'default-shib13-idp' => 'urn:mace:switch.ch:aaitest:dukono.switch.ch',
/*
* IdP Discovery service look configuration.
* Wether to display a list of idp or to display a dropdown box. For many IdP' a dropdown box
* gives the best use experience.
*
* When using dropdown box a cookie is used to highlight the previously chosen IdP in the dropdown.
* This makes it easier for the user to choose the IdP
*
* Options: [links,dropdown]
*
*/
#'idpdisco.layout' => 'dropdown',
'idpdisco.layout' => 'links',
/*
* Meta data handler.
*
......
<?php $this->includeAtTemplateBase('includes/header.php'); ?>
<div id="header">
<h1>SAML 2.0 IdP Discovery Service</h1>
<div id="poweredby"><img src="/<?php echo $data['baseurlpath']; ?>resources/icons/bino.png" alt="Bino" /></div>
</div>
<div id="content">
<h2><?php if (isset($data['header'])) { echo $data['header']; } else { echo "Select your IdP"; } ?></h2>
<p>Please select the identity provider where you want to authenticate:</p>
<form method="get" action="<?php echo $data['urlpattern']; ?>">
<input type="hidden" name="entityID" value="<?php echo $data['entityID']; ?>" />
<input type="hidden" name="return" value="<?php echo $data['return']; ?>" />
<input type="hidden" name="returnIDParam" value="<?php echo $data['returnIDParam']; ?>" />
<select name="idpentityid">
<?php
foreach ($data['idplist'] AS $idpentry) {
echo '<option value="'.$idpentry['entityid'].'"';
if ($idpentry['entityid'] == $data['preferedidp']) echo ' selected="selected"';
echo '>'.$idpentry['name'].'</option>';
}
?>
</select>
<input type="submit" value="Select"/>
</form>
<?php $this->includeAtTemplateBase('includes/footer.php'); ?>
......@@ -15,14 +15,13 @@
<?php
foreach ($data['idplist'] AS $idpentry) {
echo '<h3>' . $idpentry['name'] . '</h3>';
echo '<p>' . $idpentry['description'] . '<br />';
echo '[ <a href="' . $data['urlpattern'] . $idpentry['entityid'] . '">Select this IdP</a>]</p>';
}
?>
......
......@@ -41,21 +41,36 @@ try {
if (isset($_GET['idpentityid'])) {
$idpentityid = $_GET['idpentityid'];
setcookie('preferedidp',$idpentityid,time()+60*60*24*90); // set cookie valid 90 days
$returnurl = SimpleSAML_Utilities::addURLparameter($return, $returnidparam . '=' . $idpentityid);
SimpleSAML_Utilities::redirect($returnurl);
}
$idplist = $metadata->getList('saml20-idp-remote');
$t = new SimpleSAML_XHTML_Template($config, 'selectidp.php');
$t->data['header'] = 'Select your identity provider';
$t->data['idplist'] = $idplist;
$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
$t->show();
if ($config->getValue('idpdisco.layout') == 'dropdown') {
$t = new SimpleSAML_XHTML_Template($config, 'selectidp-dropdown.php');
$t->data['header'] = 'Select your identity provider';
$t->data['idplist'] = $idplist;
$t->data['return']= $return;
$t->data['returnIDParam'] = $returnidparam;
$t->data['entityID'] = $spentityid;
$t->data['preferedidp'] = (!empty($_COOKIE['preferedidp'])) ? $_COOKIE['preferedidp'] : null;
$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURLNoQuery());
$t->show();
}
else
{
$t = new SimpleSAML_XHTML_Template($config, 'selectidp-links.php');
$t->data['header'] = 'Select your identity provider';
$t->data['idplist'] = $idplist;
$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
$t->show();
}
?>
\ No newline at end of file
......@@ -37,21 +37,34 @@ try {
if (isset($_GET['idpentityid'])) {
$idpentityid = $_GET['idpentityid'];
setcookie('preferedidp',$idpentityid,time()+60*60*24*90); // set cookie valid 90 days
$returnurl = SimpleSAML_Utilities::addURLparameter($return, $returnidparam . '=' . $idpentityid);
SimpleSAML_Utilities::redirect($returnurl);
}
$idplist = $metadata->getList('shib13-idp-remote');
$t = new SimpleSAML_XHTML_Template($config, 'selectidp.php');
$t->data['header'] = 'Select your identity provider';
$t->data['idplist'] = $idplist;
$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
$t->show();
if ($config->getValue('disco.layout') == 'dropdown') {
$t = new SimpleSAML_XHTML_Template($config, 'selectidp-dropdown.php');
$t->data['header'] = 'Select your identity provider';
$t->data['idplist'] = $idplist;
$t->data['return']= $return;
$t->data['returnIDParam'] = $returnidparam;
$t->data['entityID'] = $spentityid;
$t->data['preferedidp'] = (!empty($_COOKIE['preferedidp'])) ? $_COOKIE['preferedidp'] : null;
$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURLNoQuery());
}
else
{
$t = new SimpleSAML_XHTML_Template($config, 'selectidp-links.php');
$t->data['header'] = 'Select your identity provider';
$t->data['idplist'] = $idplist;
$t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid=');
$t->show();
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment