ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ShibWAYF Class Reference

Class ShibbolethWAYF. More...

+ Collaboration diagram for ShibWAYF:

Public Member Functions

 ShibWAYF ()
 isSelection ()
 isValidSelection ()
 generateSelection ()
 redirect ()
 setSAMLCookie ()
 showNotice ()
 getIDPList ()
 generateCookieArray ($value)
 generateCookieValue ($CookieArray)
 appendCookieValue ($value, $CookieArray)

Data Fields

 $isSelection = false
 $isValidSelection = false
 $selectedIDP = '-'
 $IDPList = false

Detailed Description

Class ShibbolethWAYF.

This class handles the Home Organization selection (also called Where Are You From service) process for Shibboleth users.

Definition at line 32 of file class.ilShibbolethWAYF.php.

Member Function Documentation

ShibWAYF::appendCookieValue (   $value,
  $CookieArray 
)

Definition at line 246 of file class.ilShibbolethWAYF.php.

Referenced by setSAMLCookie().

{
array_push($CookieArray, $value);
$CookieArray = array_reverse($CookieArray);
$CookieArray = array_unique($CookieArray);
$CookieArray = array_reverse($CookieArray);
return $CookieArray;
}

+ Here is the caller graph for this function:

ShibWAYF::generateCookieArray (   $value)

Definition at line 225 of file class.ilShibbolethWAYF.php.

Referenced by generateSelection(), and setSAMLCookie().

{
// Decodes and splits cookie value
$CookieArray = split(' ', $value);
$CookieArray = array_map('base64_decode', $CookieArray);
return $CookieArray;
}

+ Here is the caller graph for this function:

ShibWAYF::generateCookieValue (   $CookieArray)

Definition at line 236 of file class.ilShibbolethWAYF.php.

Referenced by setSAMLCookie().

{
// Merges cookie content and encodes it
$CookieArray = array_map('base64_encode', $CookieArray);
$value = implode(' ', $CookieArray);
return $value;
}

+ Here is the caller graph for this function:

ShibWAYF::generateSelection ( )

Definition at line 85 of file class.ilShibbolethWAYF.php.

References $_COOKIE, $_GET, $IDPList, $ilSetting, $lng, $selectedIDP, generateCookieArray(), and getIDPList().

{
global $ilSetting;
// Calculate select element
$selectElement = '';
if (!$this->IDPList)
{
$idp_list = $this->getIDPList();
}
else
{
$idp_list = $this->IDPList;
}
$idp_cookie = $this->generateCookieArray($_COOKIE['_saml_idp']);
$lng = new ilLanguage($_GET["lang"]);
if (count($idp_cookie) > 0 && isset($idp_list[end($idp_cookie)]))
{
$selectedIDP = end($idp_cookie);
$selectElement = '
<select name="idp_selection">
<option value="-">'.$lng->txt("shib_member_of").'</option>';
}
else
{
$selectElement = '
<select name="idp_selection">
<option value="-" selected="selected">'.$lng->txt("shib_member_of").'</option>';
}
foreach ($idp_list as $idp_id => $idp_data){
if ($idp_id == $selectedIDP)
{
$selectElement .= '<option value="'.$idp_id.'" selected="selected">'.$idp_data[0].'</option>';
}
else
{
$selectElement .= '<option value="'.$idp_id.'">'.$idp_data[0].'</option>';
}
}
$selectElement .= '
</select>';
return $selectElement;
}

+ Here is the call graph for this function:

ShibWAYF::getIDPList ( )

Definition at line 200 of file class.ilShibbolethWAYF.php.

References $ilSetting, elseif(), and exit.

Referenced by generateSelection(), redirect(), and ShibWAYF().

{
global $ilSetting;
$idp_list = array();
$idp_raw_list = split("\n", $ilSetting->get("shib_idp_list"));
foreach ($idp_raw_list as $idp_line){
$idp_data = split(',', $idp_line);
if (isset($idp_data[2]))
{
$idp_list[trim($idp_data[0])] = array(trim($idp_data[1]),trim($idp_data[2]));
}
elseif(isset($idp_data[1]))
{
$idp_list[trim($idp_data[0])] = array(trim($idp_data[1]));
}
}
return $idp_list;
print_r($idp_list);exit;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ShibWAYF::isSelection ( )

Definition at line 70 of file class.ilShibbolethWAYF.php.

References $isSelection.

Referenced by ShibWAYF(), and showNotice().

{
}

+ Here is the caller graph for this function:

ShibWAYF::isValidSelection ( )

Definition at line 77 of file class.ilShibbolethWAYF.php.

References $isValidSelection.

Referenced by ShibWAYF(), and showNotice().

+ Here is the caller graph for this function:

ShibWAYF::redirect ( )

Definition at line 140 of file class.ilShibbolethWAYF.php.

References $_POST, $IDPList, $selectedIDP, and getIDPList().

{
if (!$this->IDPList)
{
$idp_list = $this->getIDPList();
}
else
{
$idp_list = $this->IDPList;
}
// Where to return after the authentication process
$target = trim(ILIAS_HTTP_PATH, '/').'/shib_login.php?target='.$_POST["il_target"];
$idp_data = $idp_list[$this->selectedIDP];
if (isset($idp_data[1]))
{
ilUtil::redirect($idp_data[1].'?providerId='.urlencode($this->selectedIDP).'&target='.urlencode($target));
}
else
{
// TODO: This has to be changed to /Shibboleth.sso/DS?entityId= for
// Shibbolet 2.x sometime...
ilUtil::redirect('/Shibboleth.sso?providerId='.urlencode($this->selectedIDP).'&target='.urlencode($target));
}
}

+ Here is the call graph for this function:

ShibWAYF::setSAMLCookie ( )

Definition at line 170 of file class.ilShibbolethWAYF.php.

References $_COOKIE, appendCookieValue(), generateCookieArray(), and generateCookieValue().

{
if (isset($_COOKIE['_saml_idp']))
{
$IDPArray = $this->generateCookieArray($_COOKIE['_saml_idp']);
}
else
{
$IDPArray = array();
}
$IDPArray = $this->appendCookieValue($this->selectedIDP, $IDPArray);
setcookie ('_saml_idp', $this->generateCookieValue($IDPArray), time() + (100*24*3600), '/');
}

+ Here is the call graph for this function:

ShibWAYF::ShibWAYF ( )

Definition at line 40 of file class.ilShibbolethWAYF.php.

References $_POST, getIDPList(), isSelection(), and isValidSelection().

{
// Was the WAYF form submitted?
if (isset($_POST['home_organization_selection']))
{
$this->isSelection = true;
}
else
{
$this->isSelection = false;
}
// Was selected IdP a valid
$this->IDPList = $this->getIDPList();
if (
isset($_POST['idp_selection'])
&& $_POST['idp_selection'] != '-'
&& isset($this->IDPList[$_POST['idp_selection']])
)
{
$this->isValidSelection = true;
$this->selectedIDP = $_POST['idp_selection'];
}
else
{
$this->isValidSelection = false;
}
}

+ Here is the call graph for this function:

ShibWAYF::showNotice ( )

Definition at line 185 of file class.ilShibbolethWAYF.php.

References $_GET, $lng, isSelection(), and isValidSelection().

{
$lng = new ilLanguage($_GET["lang"]);
if (!$this->isSelection() or $this->isValidSelection())
{
return '';
}
else
{
return $lng->txt("shib_invalid_home_organization");
}
}

+ Here is the call graph for this function:

Field Documentation

ShibWAYF::$IDPList = false

Definition at line 38 of file class.ilShibbolethWAYF.php.

Referenced by generateSelection(), and redirect().

ShibWAYF::$isSelection = false

Definition at line 35 of file class.ilShibbolethWAYF.php.

Referenced by isSelection().

ShibWAYF::$isValidSelection = false

Definition at line 36 of file class.ilShibbolethWAYF.php.

Referenced by isValidSelection().

ShibWAYF::$selectedIDP = '-'

Definition at line 37 of file class.ilShibbolethWAYF.php.

Referenced by generateSelection(), and redirect().


The documentation for this class was generated from the following file: