Retrieve a URL that can be used to log the user out.
$user_id = ''; $user_nick = ''; $osm_user = ''; if (isset($attr["id"])) { $user_id = $attr["id"][0]; } if (isset($attr["nick"])) { $user_nick = $attr["nick"][0]; } if (isset($attr["osm_user"])) { $logged = true; } } if ($logged) { echo "Přihlášen jako " . $user_nick . " - "; echo "<a href=\"" . $auth->getLogoutURL() . "\">odhlásit</a>"; } $f_query = 0; // zda zobrazit vysledek nebo jen formular $f_uid = 0; // uid $f_zmeny = 0; // jen v RUIAN zmenene $f_okres = 0; // okres $sort = 0; if (isset($_REQUEST['sort'])) { $sort = $_REQUEST['sort']; } if (!is_numeric($sort)) { die;
public function samlAction() { require_once SamlAuth::LIB_AUTOLOAD; $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); //In case of external service using AppDB as a SP if (isset($_GET['callbackUrl']) && trim($_GET['callbackUrl']) !== '') { $this->session->authreferer = trim($_GET['callbackUrl']); } else { if (isset($this->session->authreferer) === false) { $this->session->authreferer = $_SERVER["HTTP_REFERER"]; } } $source = $this->_getParam("source"); if ($source == null) { $source = ""; } //Check if user is already logged in if (SamlAuth::isAuthenticated() !== false) { if (isset($this->session->authreferer) && trim($this->session->authreferer) !== "") { $this->session->authreferer = str_replace("http://", "https://", $this->session->authreferer); header("Location: " . $this->session->authreferer); } else { header("Location: " . "https://" . $_SERVER['HTTP_HOST']); } return; } else { if (isset($this->session) && $this->session->isNewUser === true) { header("Location: " . "https://" . $_SERVER['HTTP_HOST']); return; } } $config = SimpleSAML_Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($config, 'core:authsource_list.tpl.php'); $t->data['sources'] = SimpleSAML_Auth_Source::getSourcesMatch('-sp'); if (!in_array($source, $t->data['sources'])) { header("Location: " . "https://" . $_SERVER['HTTP_HOST']); exit; } $as = new SimpleSAML_Auth_Simple($source); if (!$as->isAuthenticated()) { $as->requireAuth(); } $attributes = $as->getAttributes(); $uid = $attributes['idp:uid'][0]; $_SESSION['identity'] = $uid; $_SESSION['logouturl'] = $as->getLogoutURL(); $this->session->samlattrs = $attributes; $this->session->samlauthsource = $source; $this->_helper->redirector('postauth'); }
$template->data['userid'] = $userid; $template->data['user'] = $userController->getUser(); $template->data['security.context'] = sspmod_janus_DiContainer::getInstance()->getSecurityContext(); /* START TAB MESSAGE PROVISIONING *************************************************************************************/ if ($selectedtab == SELECTED_TAB_MESSAGE) { $template->data['user_type'] = $user->getType(); $template->data['subscriptions'] = $subscriptions; $template->data['subscriptionList'] = $subscriptionList; $template->data['messages'] = $messages; $template->data['messages_total'] = $messages_total; $template->data['external_messengers'] = $janus_config->getArray('messenger.external'); $template->data['current_page'] = $page; $template->data['last_page'] = ceil((double) $messages_total / $pm->getPaginationCount()); } /* END TAB MESSAGE PROVISIONING ***************************************************************************************/ $template->data['logouturl'] = $as->getLogoutURL(); /* START TAB ARPADMIN PROVISIONING ************************************************************************************/ if ($selectedtab == SELECTED_TAB_ARPADMIN) { $template->data['arp_attributes'] = $arp_attributes; } /* END TAB ARPADMIN PROVISIONING **************************************************************************************/ /* START TAB ADMIN PROVISIONING ***************************************************************************************/ if ($selectedtab == SELECTED_TAB_ADMIN) { $template->data['users'] = $userController->getUsers(); } /* END TAB ADMIN PROVISIONING *****************************************************************************************/ /* START TAB ENTITIES PROVISIONING ************************************************************************************/ if ($selectedtab == SELECTED_TAB_ENTITIES) { if (isset($old_entityid)) { $template->data['old_entityid'] = $old_entityid; }
<?php $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(); $uregconf = SimpleSAML_Configuration::getConfig('module_selfregister.php'); /* Get a reference to our authentication source. */ $asId = $uregconf->getString('auth'); $links = array(); $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/newUser.php'), 'text' => '{selfregister:selfregister:link_newuser}'); $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/lostPassword.php'), 'text' => '{selfregister:selfregister:link_lostpw}'); if ($session->isAuthenticated()) { $uregconf = SimpleSAML_Configuration::getConfig('module_selfregister.php'); if ($session->getAuthority() == $asId) { $as = new SimpleSAML_Auth_Simple($asId); $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/reviewUser.php'), 'text' => '{selfregister:selfregister:link_review}'); $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/changePassword.php'), 'text' => '{selfregister:selfregister:link_changepw}'); $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/delUser.php'), 'text' => '{selfregister:selfregister:link_deluser}'); $links[] = array('href' => $as->getLogoutURL(), 'text' => '{status:logout}'); } else { $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/reviewUser.php'), 'text' => '{selfregister:selfregister:link_enter}'); } } else { $links[] = array('href' => SimpleSAML_Module::getModuleURL('selfregister/reviewUser.php'), 'text' => '{selfregister:selfregister:link_enter}'); } $html = new SimpleSAML_XHTML_Template($config, 'selfregister:index.tpl.php', 'selfregister:selfregister'); $html->data['source'] = $asId; $html->data['links'] = $links; if (array_key_exists('status', $_GET) && $_GET['status'] == 'deleted') { $html->data['userMessage'] = 'message_userdel'; } $html->show();
function saml_logout() { global $SAML_options; if (!file_exists($SAML_options['simplesamlphp_basedir'] . '/lib/_autoload.php')) { throw new RackTablesError('Configured for SAML authentication, but simplesaml is not found.', RackTablesError::MISCONFIGURED); } require_once $SAML_options['simplesamlphp_basedir'] . '/lib/_autoload.php'; $as = new SimpleSAML_Auth_Simple($SAML_options['sp_profile']); header("Location: " . $as->getLogoutURL('/')); exit; }
private function getAttributesInitToken() { require_once '/var/simplesamlphp/lib/_autoload.php'; $auth = new \SimpleSAML_Auth_Simple('default-sp'); $auth->requireAuth(); \Factory::$properties['LOGOUTURL'] = $auth->getLogoutURL('https://' . gethostname()); $attributes = $auth->getAttributes(); if (!empty($attributes)) { // which idp did the user select? $idp = $auth->getAuthData('saml:sp:IdP'); // EGI IdP if ($idp == 'https://www.egi.eu/idp/shibboleth') { // For EGI federated id: //$dnAttribute = $attributes['urn:oid:1.3.6.1.4.1.11433.2.2.1.9'][0]; //if (!empty($dnAttribute)) { // $this->principle = str_replace("emailAddress=", "Email=", $dnAttribute); // $this->userDetails = array('AuthenticationRealm' => array('EGI_SSO_IDP')); //} $nameID = $auth->getAuthData('saml:sp:NameID'); $this->principle = $nameID['Value']; $this->userDetails = array('AuthenticationRealm' => array('EGI_SSO_IDP')); // iterate the attributes and store in the userDetails // Each attribute name can be used as an index into $attributes to obtain the value. // Every attribute value is an array - a single-valued attribute is an array of a single element. foreach ($attributes as $key => $valArray) { $this->userDetails[$key] = $valArray; } } else { if ($idp == 'https://unity.eudat-aai.fz-juelich.de:8443/saml-idp/metadata') { // For EUDAT federated id: //$dnAttribute = $attributes['urn:oid:2.5.4.49'][0]; //$dnAttribute = $attributes['unity:identity:persistent'][0]; //print_r($attributes); $nameID = $auth->getAuthData('saml:sp:NameID'); $this->principle = $nameID['Value']; $this->userDetails = array('AuthenticationRealm' => array('EUDAT_SSO_IDP')); // iterate the attributes and store in the userDetails // Each attribute name can be used as an index into $attributes to obtain the value. // Every attribute value is an array - a single-valued attribute is an array of a single element. foreach ($attributes as $key => $valArray) { $this->userDetails[$key] = $valArray; } } } } }