diff --git a/auth/oauth2/linkedin_token.php b/auth/oauth2/linkedin_token.php index d4e88e4732f6b26fe3d3bc8ec850ede492fcc814..e2ec27534362001aaca7a09c6ac95b423a7dedb0 100644 --- a/auth/oauth2/linkedin_token.php +++ b/auth/oauth2/linkedin_token.php @@ -61,17 +61,19 @@ curl_setopt($conn1, CURLOPT_POSTFIELDS, $post_string); //perform our request $result1 = curl_exec($conn1); +$info1 = curl_getinfo($conn1); -if ($result1) { +if ($info1['http_code'] === 200) { $my_token = json_decode($result1, TRUE); $access_token = $my_token['access_token']; $expires_in = $my_token['expires_in']; curl_close($conn1); } else { //show information regarding the error - $errorMessage = curl_errno($conn1) . "-"; - $errorMessage = $errorMessage . curl_error($conn1); + $errorMessage = "Error: LinkedIn server response code: " . $info1['http_code'] . " - "; + $errorMessage .= curl_error($conn1); curl_close($conn1); + http_response_code(500); die($errorMessage); } @@ -84,8 +86,9 @@ curl_setopt($conn2, CURLOPT_HTTPHEADER, array( curl_setopt($conn2, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($conn2); +$info2 = curl_getinfo($conn2); -if ($result) { +if ($info2['http_code'] === 200) { $data = json_decode($result, TRUE); curl_close($conn2); @@ -116,7 +119,7 @@ if ($result) { $callbackHandler->manageLoginRedirect($user, $session); } else { //show information regarding the error - $errorMessage = curl_errno($conn2) . "-"; + $errorMessage = "Error: LinkedIn server response code: " . $info2['http_code'] . " - "; $errorMessage = $errorMessage . curl_error($conn2); curl_close($conn2); die($errorMessage); diff --git a/classes/CallbackHandler.php b/classes/CallbackHandler.php index bd48a0d8d8df9612cb8dc09c9496aa6998ae839c..44840615d1e9525303afce2ef40d5cc9f4ce149b 100644 --- a/classes/CallbackHandler.php +++ b/classes/CallbackHandler.php @@ -36,37 +36,65 @@ class CallbackHandler { $this->callbacks = $callbacks; } + /** + * If a callback URL is not in the configured list we should return null. + */ + public function filterCallbackURL($callbackURL) { + foreach ($this->callbacks as $callback) { + if ($callback['url'] === $callbackURL) { + return $callbackURL; + } + } + return null; + } + /** * returns null if the callback URL is not listed in configuration file. */ public function getCallbackTitle($callbackURL) { - if ($callbackURL === null) { - return "Account Management"; + foreach ($this->callbacks as $callback) { + if ($callback['url'] === $callbackURL) { + return $callback['title']; + } } + return null; + } + + public function getCallbackLogo($callbackURL) { + foreach ($this->callbacks as $callback) { if ($callback['url'] === $callbackURL) { - return $callback['title']; + if (array_key_exists('logo', $callback)) { + return $callback['logo']; + } else { + return null; + } } } - throw new \Exception("Unauthorized callback URL"); + return null; } public function manageLoginRedirect($user, SessionData $session) { - if ($session->getCallbackURL() !== null) { - // External login using token - header('Location: ' . $this->getLoginWithTokenURL($user->id, $session->getCallbackURL())); - die(); - } else { + if ($session->getCallbackURL() === null) { + http_response_code(401); + die("Unauthorized callback URL"); + } + + if ($session->getCallbackURL() === $this->basePath . '/') { // Login in session $session->user = $user; $session->save(); // Return to index header('Location: ' . $this->basePath); die(); + } else { + // External login using token + header('Location: ' . $this->getLoginWithTokenURL($user->id, $session->getCallbackURL())); + die(); } } diff --git a/classes/GrouperClient.php b/classes/GrouperClient.php deleted file mode 100644 index 73029c35f2c308fa14cc14ab33aacf4d2db29c97..0000000000000000000000000000000000000000 --- a/classes/GrouperClient.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php - -/* ---------------------------------------------------------------------------- - * INAF - National Institute for Astrophysics - * IRA - Radioastronomical Institute - Bologna - * OATS - Astronomical Observatory - Trieste - * ---------------------------------------------------------------------------- - * - * Copyright (C) 2016 Istituto Nazionale di Astrofisica - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License Version 3 as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -namespace RAP; - -class GrouperClient { - - private $client; - - function __construct($config) { - - $this->client = new \SoapClient($config['wsdlURL'], array( - 'login' => $config['user'], - 'password' => $config['password'], - 'trace' => 1, - // See: https://bugs.php.net/bug.php?id=36226 - 'features' => SOAP_SINGLE_ELEMENT_ARRAYS - ) - ); - } - - private function getBaseRequestParams() { - return array( - 'clientVersion' => 'v2_3_000' - ); - } - - private function startsWith($haystack, $needle) { - return strpos($haystack, "$needle", 0) === 0; - } - - private function isSuccess($response) { - $success = isset($response->return->resultMetadata) && $response->return->resultMetadata->resultCode === 'SUCCESS'; - if (!$success) { - throw new \Exception("Web Service Failure. Response=" . json_encode($response)); - } - return $success; - } - - public function getSubjectGroups($subjectId) { - - $params = $this->getBaseRequestParams(); - $params['subjectLookups'] = array( - 'subjectId' => $subjectId, - 'subjectSourceId' => 'RAP' - ); - - $response = $this->client->getGroups($params); - - if ($this->isSuccess($response)) { - if (count($response->return->results) === 1) { - $groups = []; - if ($response->return->results[0]->wsGroups !== null) { - foreach ($response->return->results[0]->wsGroups as $group) { - if (!$this->startsWith($group->name, 'etc:')) { - array_push($groups, $group->name); - } - } - } - return $groups; - } else { - throw new \Exception("Wrong results number. Response=" . json_encode($response)); - } - } - } - - public function getSubjectPrivileges($subjectId) { - - $params = $this->getBaseRequestParams(); - $params['subjectId'] = $subjectId; - $params['subjectSourceId'] = 'RAP'; - - $response = $this->client->getGrouperPrivilegesLite($params); - - $privilegesMap = []; - if ($this->isSuccess($response)) { - if ($response->return->privilegeResults !== null) { - foreach ($response->return->privilegeResults as $item) { - $groupName = $item->wsGroup->name; - $privilege = $item->privilegeName; - - if (!array_key_exists($groupName, $privilegesMap)) { - $groupPrivileges = []; - } else { - $groupPrivileges = $privilegesMap[$groupName]; - } - $groupPrivileges[] = $privilege; - $privilegesMap[$groupName] = $groupPrivileges; - } - } - } - - return $privilegesMap; - } - - private function getBasePrivilegeRequestParams($subjectId, $groupName, $privilegeNames) { - $params = $this->getBaseRequestParams(); - $params['wsSubjectLookups'] = array( - 'subjectId' => $subjectId, - 'subjectSourceId' => 'RAP' - ); - $params['wsGroupLookup'] = array( - 'groupName' => $groupName - ); - $params['privilegeNames'] = $privilegeNames; - - return $params; - } - - public function assignPrivileges($subjectId, $groupName, $privilegeNames) { - - $params = $this->getBasePrivilegeRequestParams($subjectId, $groupName, $privilegeNames); - $params['allowed'] = 'T'; // true - - return $this->client->assignGrouperPrivileges($params); - } - - public function removePrivileges($subjectId, $groupName, $privilegeNames) { - - $params = $this->getBasePrivilegeRequestParams($subjectId, $groupName, $privilegeNames); - $params['allowed'] = 'F'; // false - - return $this->client->assignGrouperPrivileges($params); - } - - public function addMemberships($subjectId, $groups) { - - foreach ($groups as $group) { - $params = $this->getBaseRequestParams(); - $params['subjectId'] = $subjectId; - $params['subjectSourceId'] = 'RAP'; - $params['groupName'] = $group; - - $this->client->addMemberLite($params); - } - } - - public function removeMemberships($subjectId, $groups) { - - foreach ($groups as $group) { - $params = $this->getBaseRequestParams(); - $params['subjectId'] = $subjectId; - $params['subjectSourceId'] = 'RAP'; - $params['groupName'] = $group; - - $this->client->deleteMemberLite($params); - } - } - -} diff --git a/classes/MailSender.php b/classes/MailSender.php index 606743db11c1d66ec77371851a9558420a7ae7cf..67742f43c7330f6abadf9ed19a149c8ced4c08b9 100644 --- a/classes/MailSender.php +++ b/classes/MailSender.php @@ -72,9 +72,12 @@ class MailSender { $body .= "<br/>"; } - $body .= "<br/>If you and this user are the same person click on the following link for joining your accounts:<br/>"; + $body .= "<br/>If you and this user are <b>the same person</b> click on the following link for joining your accounts:<br/>"; $body .= "<a href=\"$confirmJoinURL\" target=\"blank_\">$confirmJoinURL</a>"; - $body .= "<br/><br/>Otherwise you can ignore this email<br/><br/>"; + $body .= "<br/><br/>Otherwise you can ignore this email.<br/>"; + + $body .= '<p><b>Please don\'t use this functionality for sharing resources between your coworkers</b>, use <a href="https://sso.ia2.inaf.it/grouper">Grouper</a> for that.</p>'; + $body .= '<br/>'; $body .= "<b>*** This is an automatically generated email, please do not reply to this message ***</b><br/>"; $body .= "If you need information please contact <a href=\"mailto:ia2@oats.inaf.it\">IA2 Staff</a>"; diff --git a/classes/MySQLDAO.php b/classes/MySQLDAO.php index 4dc5bccb446e011e9dc8e90605847d5dbf38fc21..02dea0dffc9e672a6d7bed6fe7ded8af2a234ba2 100644 --- a/classes/MySQLDAO.php +++ b/classes/MySQLDAO.php @@ -208,7 +208,8 @@ class MySQLDAO implements DAO { . " i.`id`, `type`, `typed_id`, `email`, `name`, `surname`, `institution`, `eppn`" . " FROM identity i" . " JOIN `user` u on u.id = i.user_id" - . " WHERE `email` LIKE :email OR `name` LIKE :name OR `surname` LIKE :surname"; + . " WHERE `email` LIKE :email OR `name` LIKE :name OR `surname` LIKE :surname" + . " OR CONCAT(`name`,' ',`surname`) LIKE :namesurname"; $stmt = $dbh->prepare($query); @@ -216,6 +217,7 @@ class MySQLDAO implements DAO { $stmt->bindParam(':email', $searchParam); $stmt->bindParam(':name', $searchParam); $stmt->bindParam(':surname', $searchParam); + $stmt->bindParam(':namesurname', $searchParam); $stmt->execute(); diff --git a/classes/SessionData.php b/classes/SessionData.php index 8dd9f52aef31003d8c71f55fb8646e30efcfceaa..4b365a84254964525e4ba50a57a80cae9bbf4517 100644 --- a/classes/SessionData.php +++ b/classes/SessionData.php @@ -29,6 +29,7 @@ class SessionData { private $dao; private $callbackURL; private $callbackTitle; + private $callbackLogo; public $user; public $userSearchResults; public $x509DataToRegister; @@ -51,8 +52,9 @@ class SessionData { } public function setCallbackURL(CallbackHandler $callbackHandler, $callbackURL) { - $this->callbackURL = $callbackURL; + $this->callbackURL = $callbackHandler->filterCallbackURL($callbackURL); $this->callbackTitle = $callbackHandler->getCallbackTitle($callbackURL); + $this->callbackLogo = $callbackHandler->getCallbackLogo($callbackURL); $this->save(); } @@ -64,6 +66,10 @@ class SessionData { return $this->callbackTitle; } + public function getCallbackLogo() { + return $this->callbackLogo; + } + public function searchUser($searchText) { $users = $this->dao->searchUser($searchText); diff --git a/classes/UserHandler.php b/classes/UserHandler.php index b0b733030d2d134ad39507486424e00c8349d4a7..5f1d52d9ce225ef9ac9b7d05e82417698c6c95e2 100644 --- a/classes/UserHandler.php +++ b/classes/UserHandler.php @@ -60,30 +60,47 @@ class UserHandler { return $this->dao->findUserByIdentity($type, $identifier); } - public function joinUsers($userId1, $userId2) { + private function getJoinURL() { + $joinURL = $this->grouperConfig['wsURL']; - if ($this->grouperConfig !== null) { - $gc = new GrouperClient($this->grouperConfig); + if (substr($joinURL, -1) !== '/') { + $joinURL .= '/'; + } + $joinURL .= 'ia2join'; - $grouperUser1 = 'RAP:' . $userId1; - $grouperUser2 = 'RAP:' . $userId2; + return $joinURL; + } - $groupsToMove = $gc->getSubjectGroups($grouperUser2); - $privilegesMap = $gc->getSubjectPrivileges($grouperUser2); + public function joinUsers($userId1, $userId2) { - // Adding memberships - $gc->addMemberships($grouperUser1, $groupsToMove); - // Adding privileges - foreach ($privilegesMap as $groupName => $privileges) { - $gc->assignPrivileges($grouperUser1, $groupName, $privileges); - } + if ($this->grouperConfig !== null) { - // Removing privileges - foreach ($privilegesMap as $groupName => $privileges) { - $gc->removePrivileges($grouperUser2, $groupName, $privileges); + //create cURL connection + $conn = curl_init($this->getJoinURL()); + + //set options + curl_setopt($conn, CURLOPT_CONNECTTIMEOUT, 30); + curl_setopt($conn, CURLOPT_RETURNTRANSFER, true); + curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($conn, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($conn, CURLOPT_USERPWD, $this->grouperConfig['user'] . ":" . $this->grouperConfig['password']); + + //set data to be posted + curl_setopt($conn, CURLOPT_POST, 1); + curl_setopt($conn, CURLOPT_POSTFIELDS, "subject1Id=RAP:$userId1&subject2Id=RAP:$userId2"); + + //perform the request + $response = curl_exec($conn); + $info = curl_getinfo($conn); + + if ($info['http_code'] === 200) { + curl_close($conn); + } else { + //show information regarding the error + curl_close($conn); + http_response_code(500); + die('Error: Grouper response code: ' . $info['http_code']); } - // Removing memberships - $gc->removeMemberships($grouperUser2, $groupsToMove); } $this->dao->joinUsers($userId1, $userId2); diff --git a/config.php b/config.php index d4cc396672031fad8877f1a34ee71ebb835d5c18..d73e7e8587be9a22f682e3fbb897bac4b54626b4 100644 --- a/config.php +++ b/config.php @@ -23,7 +23,7 @@ */ $CONTEXT_ROOT = "/rap-ia2"; -$VERSION = "1.0.0"; +$VERSION = "1.0.1"; $PROTOCOL = stripos($_SERVER['SERVER_PROTOCOL'], 'https') ? 'https://' : 'http://'; $BASE_PATH = $PROTOCOL . $_SERVER['HTTP_HOST'] . $CONTEXT_ROOT; @@ -34,7 +34,13 @@ $LOG_LEVEL = Monolog\Logger::DEBUG; $CALLBACKS = [ array( 'url' => 'http://localhost:8087/grouper', - 'title' => 'Login to Grouper' + 'title' => 'Login to Grouper', + 'logo' => 'grouper.png' + ), + array( + 'url' => 'http://localhost/rap-ia2/', + 'title' => 'Account Management', + 'logo' => 'account-manager.png' ) ]; @@ -73,7 +79,12 @@ $AUTHENTICATION_METHODS = array( ); $GROUPER = array( - 'wsdlURL' => 'http://localhost:8087/grouper-ws/services/GrouperService_v2_3?wsdl', + 'wsURL' => 'http://localhost:8087/grouper-ws/', 'user' => 'GrouperSystem', 'password' => '***REMOVED***' ); +/*$GROUPER = array( + 'wsURL' => 'https://sso.ia2.inaf.it/grouper-ws/', + 'user' => 'GrouperSystem', + 'password' => '***REMOVED***321' +);*/ diff --git a/css/animation.css b/css/animation.css index ac5a9562fbd637637048f00b8a8eb86e6dbb4f88..be95362c851d3dd2a72cbbf8936fcd804271a077 100644 --- a/css/animation.css +++ b/css/animation.css @@ -1,85 +1,151 @@ +@charset "UTF-8"; /* Animation example, for spinners */ .animate-spin { - -moz-animation: spin 2s infinite linear; - -o-animation: spin 2s infinite linear; - -webkit-animation: spin 2s infinite linear; - animation: spin 2s infinite linear; - display: inline-block; + -moz-animation: spin 2s infinite linear; + -o-animation: spin 2s infinite linear; + -webkit-animation: spin 2s infinite linear; + animation: spin 2s infinite linear; + display: inline-block; } @-moz-keyframes spin { - 0% { - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - - 100% { - -moz-transform: rotate(359deg); - -o-transform: rotate(359deg); - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -moz-transform: rotate(0deg); + -o-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -moz-transform: rotate(359deg); + -o-transform: rotate(359deg); + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } } @-webkit-keyframes spin { - 0% { - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - - 100% { - -moz-transform: rotate(359deg); - -o-transform: rotate(359deg); - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -moz-transform: rotate(0deg); + -o-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -moz-transform: rotate(359deg); + -o-transform: rotate(359deg); + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } } @-o-keyframes spin { - 0% { - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - - 100% { - -moz-transform: rotate(359deg); - -o-transform: rotate(359deg); - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -moz-transform: rotate(0deg); + -o-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -moz-transform: rotate(359deg); + -o-transform: rotate(359deg); + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } } @-ms-keyframes spin { - 0% { - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - - 100% { - -moz-transform: rotate(359deg); - -o-transform: rotate(359deg); - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -moz-transform: rotate(0deg); + -o-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -moz-transform: rotate(359deg); + -o-transform: rotate(359deg); + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } } @keyframes spin { - 0% { - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - - 100% { - -moz-transform: rotate(359deg); - -o-transform: rotate(359deg); - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -moz-transform: rotate(0deg); + -o-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -moz-transform: rotate(359deg); + -o-transform: rotate(359deg); + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} + +/*! + * animate.css -http://daneden.me/animate + * Version - 3.5.2 + * Licensed under the MIT license - http://opensource.org/licenses/MIT + * + * Copyright (c) 2017 Daniel Eden + */ +.animated { + animation-duration: 1s; + animation-fill-mode: both; +} + +.animated.infinite { + animation-iteration-count: infinite; } + +.animated.hinge { + animation-duration: 2s; +} + +.animated.flipOutX, +.animated.flipOutY, +.animated.bounceIn, +.animated.bounceOut { + animation-duration: .75s; +} + + +@keyframes bounceIn { + from, 20%, 40%, 60%, 80%, to { + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + transform: scale3d(.3, .3, .3); + } + + 20% { + transform: scale3d(1.1, 1.1, 1.1); + } + + 40% { + transform: scale3d(.9, .9, .9); + } + + 60% { + opacity: 1; + transform: scale3d(1.03, 1.03, 1.03); + } + + 80% { + transform: scale3d(.97, .97, .97); + } + + to { + opacity: 1; + transform: scale3d(1, 1, 1); + } +} + +.bounceIn { + animation-name: bounceIn; +} \ No newline at end of file diff --git a/css/style.css b/css/style.css index cc7f30afc9cf325a7d089d2eb0e4046b83d27698..bdc99e9b4961043543d61226d7dd80977a5640db 100644 --- a/css/style.css +++ b/css/style.css @@ -27,7 +27,7 @@ body { vertical-align: middle; } -@keyframes pulse { +@keyframes home_pulse { from { transform: scale(1, 1); } @@ -64,7 +64,7 @@ body { .home-box .img-wrapper a:hover { animation-duration: 0.2s; animation-fill-mode: both; - animation-name: pulse; + animation-name: home_pulse; animation-timing-function: ease-in; } @@ -174,4 +174,15 @@ body { } .primary-identity-icon a:hover { color: #888; +} + +.services-list-wrapper { + font-size: 18px; +} +.services-list-wrapper .btn-link { + font-size: 17px; +} +.service-logo { + padding-right: 10px; + max-height: 50px; } \ No newline at end of file diff --git a/include/footer.php b/include/footer.php index 5d0b79f247b35a8184b75b34a6afb30da2e3b2a1..39fdc446951d8e3936a02716fb077050de1e152a 100644 --- a/include/footer.php +++ b/include/footer.php @@ -1,3 +1,18 @@ +<br/> +<div class="row"> + <div class="col-sm-8 col-sm-offset-2"> + <div class="alert alert-info text-center"> + <div class="animated bounceIn hinge"> + <span class="glyphicon glyphicon-info-sign"></span> + <strong>Need help?</strong> Please read our <a href="https://sso.ia2.inaf.it/home/index.php?lang=en"><u>User guide</u></a> and <a href="https://sso.ia2.inaf.it/home/faq.php?lang=en"><u>FAQ</u></a>. + </div> + </div> + </div> +</div> +<div class="text-center"> + <a href="https://sso.ia2.inaf.it/home/privacy.php?lang=en" target="blank_">Privacy policy</a> +</div> + </div> <div class="waiting hide"> <span class="icon-wrapper"> diff --git a/include/front-controller.php b/include/front-controller.php index bab647c1125224bfd2e02dddc79999c2bbae88d3..5010fcd46ea86dba2614df64244aba63e49eebd5 100644 --- a/include/front-controller.php +++ b/include/front-controller.php @@ -20,8 +20,11 @@ function setCallback($callback) { Flight::route('/', function() { startSession(); $callback = setCallback(Flight::request()->data['callback']); - global $session, $callbackHandler, $AUTHENTICATION_METHODS; - if ($callback !== null && $session->user !== null) { + global $session, $callbackHandler, $BASE_PATH, $AUTHENTICATION_METHODS; + if ($callback === null && $session->user === null) { + Flight::render('services-list.php', array('title' => 'RAP', + 'action' => $BASE_PATH . '/')); + } else if ($callback !== null && $session->user !== null) { $redirectURL = $callbackHandler->getLoginWithTokenURL($session->user->id, $callback); Flight::redirect($redirectURL); } else { diff --git a/include/header.php b/include/header.php index 45b48d5e4444515ef4a3531bde4439cc76872359..64d7268d0d0939ebddd610122c06aef2eb30d0e3 100644 --- a/include/header.php +++ b/include/header.php @@ -7,8 +7,8 @@ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> - <link rel="stylesheet" href="css/style.css" /> - <link rel="stylesheet" href="css/animation.css" /> + <link rel="stylesheet" href="css/style.css?v=2" /> + <link rel="stylesheet" href="css/animation.css?v=2" /> <script src="js/script.js"></script> </head> <body> diff --git a/service-logos/account-manager.png b/service-logos/account-manager.png new file mode 100644 index 0000000000000000000000000000000000000000..23c914f1b7886d3451ad13be8ac3e5ef3ccd8d41 Binary files /dev/null and b/service-logos/account-manager.png differ diff --git a/service-logos/asiago.gif b/service-logos/asiago.gif new file mode 100644 index 0000000000000000000000000000000000000000..18dbb154e2cc4f13bcab57ad332d932995f6a17f Binary files /dev/null and b/service-logos/asiago.gif differ diff --git a/service-logos/grouper.png b/service-logos/grouper.png new file mode 100644 index 0000000000000000000000000000000000000000..b3ee45d31f45ba97614cdd6cbbc67243fe51f709 Binary files /dev/null and b/service-logos/grouper.png differ diff --git a/service-logos/tng.png b/service-logos/tng.png new file mode 100644 index 0000000000000000000000000000000000000000..719dd541c971506e67d5ca26444ce98ad36c1f7d Binary files /dev/null and b/service-logos/tng.png differ diff --git a/views/index.php b/views/index.php index bd9a127e7af00b46a0cfe85721a18348fa75b134..c667d11d193c9710181fc9e1ef24bd1c623daccd 100644 --- a/views/index.php +++ b/views/index.php @@ -6,7 +6,16 @@ include 'include/header.php'; <?php if ($session->user === null) { ?> <div class="row"> <div class="col-xs-12"> - <h1 class="text-center page-title"><?php echo $session->getCallbackTitle(); ?></h1> + <h1 class="text-center page-title"> + <?php + if ($session->getCallbackLogo() != null) { + ?> + <img class="service-logo" src="service-logos/<?php echo $session->getCallbackLogo(); ?>" alt="" /> + <?php + } + echo $session->getCallbackTitle(); + ?> + </h1> </div> </div> <div class="row" id="auth-panel"> diff --git a/views/services-list.php b/views/services-list.php new file mode 100644 index 0000000000000000000000000000000000000000..800bff9654125da92247db2bed6a87747f2668d3 --- /dev/null +++ b/views/services-list.php @@ -0,0 +1,37 @@ +<?php +include 'include/header.php'; +?> +<div class="col-sm-offset-2 col-sm-10 services-list-wrapper"> + <p>Please choose the service where you want to login:</p> + <ul> + <li> + <form action="<?php echo $action; ?>" method="POST"> + <input name="callback" type="hidden" value="http://archives.ia2.inaf.it/tng/rest/login/rapinput" /> + <input type="submit" class="btn btn-link" value="Telescopio Nazionale Galileo (TNG) portal" /> + </form> + </li> + <li> + <form action="<?php echo $action; ?>" method="POST"> + <input name="callback" type="hidden" value="http://archives.ia2.inaf.it/aao/rest/login/rapinput" /> + <input type="submit" class="btn btn-link" value="Asiago Astrophysical Observatory portal" /> + </form> + </li> + <li> + <form action="<?php echo $action; ?>" method="POST"> + <input name="callback" type="hidden" value="<?php echo $action; ?>" /> + <input type="submit" class="btn btn-link" value="RAP Account Management" /> + </form> + </li> + <li> + <form action="<?php echo $action; ?>" method="POST"> + <input name="callback" type="hidden" value="https://sso.ia2.inaf.it/grouper" /> + <input type="submit" class="btn btn-link" value="Grouper (groups management)" /> + </form> + </li> + </ul> + <br/> +</div> + +<?php +include 'include/footer.php'; +