From a16f982425cfafff83a24c3f9e8536975d95cbd0 Mon Sep 17 00:00:00 2001 From: Anders Lund <anders.lund@uninett.no> Date: Thu, 12 Jun 2008 11:43:10 +0000 Subject: [PATCH] Add information about what service a user is coming from. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@642 44740490-163a-0410-bde0-09ae8108e29a --- www/auth/login-feide.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/www/auth/login-feide.php b/www/auth/login-feide.php index cabd8e225..52a99407e 100644 --- a/www/auth/login-feide.php +++ b/www/auth/login-feide.php @@ -39,6 +39,25 @@ if (!array_key_exists('RelayState', $_REQUEST)) { SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE'); } +/* + * Fetch information about the service the user is coming from. + */ +if (!array_key_exists('AuthId', $_REQUEST)) { + SimpleSAML_Utilities::fatalError($session->getTrackID(), null, new Exception('This login module does not support local login without reference to a Login request')); +} +if (!array_key_exists('protocol', $_REQUEST)) { + SimpleSAML_Utilities::fatalError($session->getTrackID(), null, new Exception('Protocol URL parameter was not set')); +} +if ($_REQUEST['protocol'] != 'saml2') { + SimpleSAML_Utilities::fatalError($session->getTrackID(), null, new Exception('This login module only works with SAML 2.0')); +} + +$protocol = $_REQUEST['protocol']; +$authid = $_REQUEST['AuthId']; +$authrequestcache = $session->getAuthnRequest($protocol, $authid); + +$spentityid = $authrequestcache['Issuer']; +$spmetadata = $metadata->getMetadata($spentityid, 'saml20-sp-remote'); $error = null; $attributes = array(); @@ -235,7 +254,12 @@ $t = new SimpleSAML_XHTML_Template($config, 'login-feide.php', 'login.php'); $t->data['header'] = 'simpleSAMLphp: Enter username and password'; $t->data['relaystate'] = $_REQUEST['RelayState']; $t->data['ldapconfig'] = $ldaporgconfig; -#$t->data['orgconfig'] = $orgconfig; +$t->data['protocol'] = $protocol; +$t->data['authid'] = $authid; +$t->data['splogo'] = $spmetadata['logo']; +$t->data['spdesc'] = $spmetadata['description']; +$t->data['spname'] = $spmetadata['name']; +$t->data['contact'] = $spmetadata['contact']; $t->data['selectorg'] = $selectorg; $t->data['org'] = $org; -- GitLab