<?php /** * This is the page the user lands on when choosing "no" in the consent form. * * @package simpleSAMLphp * @version $Id$ */ if (!array_key_exists('StateId', $_REQUEST)) { throw new SimpleSAML_Error_BadRequest('Missing required StateId query parameter.'); } $id = $_REQUEST['StateId']; $state = SimpleSAML_Auth_State::loadState($id, 'consent:request'); $resumeFrom = SimpleSAML_Module::getModuleURL('consent/getconsent.php'); $resumeFrom = SimpleSAML_Utilities::addURLParameter($resumeFrom, array('StateId' => $id)); $aboutService = NULL; if (isset($state['Destination']['url.about'])) { $aboutService = $state['Destination']['url.about']; } $globalConfig = SimpleSAML_Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'consent:noconsent.php'); $t->data['dstMetadata'] = $state['Destination']; $t->data['resumeFrom'] = $resumeFrom; $t->data['aboutService'] = $aboutService; $t->show();
$metaBuilder->addContact('technical', array('emailAddress' => $config->getString('technicalcontact_email', NULL), 'name' => $config->getString('technicalcontact_name', NULL))); $metaxml = $metaBuilder->getEntityDescriptorText(); /* Sign the metadata if enabled. */ $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $spmeta, 'SAML 2 SP'); /* * Generate list of IdPs that you can send metadata to. */ $idplist = $metadata->getList('saml20-idp-remote'); $idpsend = array(); foreach ($idplist as $entityid => $mentry) { if (array_key_exists('send_metadata_email', $mentry)) { $idpsend[$entityid] = $mentry; } } $adminok = SimpleSAML_Utilities::isAdmin(); $adminlogin = SimpleSAML_Utilities::getAdminLoginURL(SimpleSAML_Utilities::addURLParameter(SimpleSAML_Utilities::selfURLNoQuery(), array('output' => 'xhtml'))); $sentok = FALSE; /* * Send metadata to Identity Provider, if the user filled submitted the form */ if (array_key_exists('sendtoidp', $_POST)) { if (!array_key_exists($_POST['sendtoidp'], $idpsend)) { throw new Exception('Entity ID ' . $_POST['sendtoidp'] . ' not found in metadata. Cannot send metadata to this IdP.'); } $emailadr = $idpsend[$_POST['sendtoidp']]['send_metadata_email']; $from = $_POST['email']; $message = '<h1>simpleSAMLphp SAML 2.0 Service Provider Metadata</h1> <p>Metadata was sent to you from a simpleSAMLphp SAML 2.0 Service Provider. The service provider requests to connect to the following Identity Provider: <ul> <li><tt>' . htmlentities($_POST['sendtoidp']) . '</tt></li>
/** * Check for session cookie, and show missing-cookie page if it is missing. * * @param string|NULL $retryURL The URL the user should access to retry the operation. */ public static function checkCookie($retryURL = NULL) { assert('is_string($retryURL) || is_null($retryURL)'); $session = SimpleSAML_Session::getInstance(); if ($session->hasSessionCookie()) { return; } /* We didn't have a session cookie. Redirect to the no-cookie page. */ $url = SimpleSAML_Module::getModuleURL('core/no_cookie.php'); if ($retryURL !== NULL) { $url = SimpleSAML_Utilities::addURLParameter($url, array('retryURL' => $retryURL)); } SimpleSAML_Utilities::redirect($url); }
/** * Create a link which will POST data. * * @param string $destination The destination URL. * @param array $post The name-value pairs which will be posted to the destination. * @return string An URL which can be accessed to post the data. */ public static function createPostRedirectLink($destination, $post) { assert('is_string($destination)'); assert('is_array($post)'); $id = SimpleSAML_Utilities::generateID(); $postData = array('post' => $post, 'url' => $destination); $session = SimpleSAML_Session::getInstance(); $session->setData('core_postdatalink', $id, $postData); return SimpleSAML_Utilities::addURLParameter(SimpleSAML_Module::getModuleURL('core/postredirect.php'), array('RedirId' => $id)); }