Beispiel #1
0
 public function pre_process($person)
 {
     parent::pre_process($person);
     $auth = AuthHandler::getAuthManager($this->person);
     $this->discoPath = $auth->getDiscoPath();
     /*
      * Handle country AuthN redirect. Both can redirect, if they don't, show
      * the map.
      */
     $nren = NREN_Handler::getNREN($_SERVER['SERVER_NAME']);
     if (!empty($nren)) {
         $this->redirectToWAYF($nren);
         $this->forwardToDisco($nren);
     }
     /* if not redirected, continue  */
     if (array_key_exists('country', $_GET)) {
         $this->selected_country = htmlentities($_GET['country']);
         $nren = NREN_Handler::getNREN($url, 1);
         echo "redirecting to idp-part for " . $this->selected_country . ", stopping rendering of this page now\n";
         exit(0);
     }
     /* textual view? */
     if (array_key_exists('textual_view', $_GET)) {
         if ($_GET['textual_view'] === "yes") {
             $this->mapMode = false;
         }
     } else {
         /* ok, show map */
         $this->tpl->assign('extraScripts', array('js/jquery-1.6.1.min.js', 'js/jquery-jvectormap-1.1.1.min.js', 'js/jquery-jvectormap-europe-mill-en.js'));
     }
 }
Beispiel #2
0
 /**
  * @throws CGE_CriticalAttributeException If an attribute needed for the operation of Confusa is not found
  * @throws MapNotFoundException If the NREN-map for the attributes is not found
  */
 public function authenticate()
 {
     /* if login, trigger SAML-redirect first */
     $auth = AuthHandler::getAuthManager($this->person);
     $authRequired = $this->contentPage->is_protected() || isset($_GET['start_login']) && $_GET['start_login'] === 'yes';
     $auth->authenticate($authRequired);
     /* show a warning if the person does not have Confusa
      * entitlement and ConfusaAdmin entitlement */
     if ($this->person->isAuth()) {
         if ($this->person->testEntitlementAttribute(Config::get_config('entitlement_user')) == false) {
             if ($this->person->testEntitlementAttribute(Config::get_config('entitlement_admin')) == false) {
                 $entitlement = Config::get_config('entitlement_namespace') . ":";
                 $entitlement .= Config::get_config('entitlement_user');
                 $msg = $this->contentPage->translateMessageTag('fw_error_entitlement_unset_1');
                 $msg .= "<br /><i>{$entitlement}</i><br /><br />";
                 $msg .= $this->contentPage->translateMessageTag('fw_error_entitlement_unset_2');
                 if (!is_null($this->person->getSubscriber())) {
                     $url = $this->person->getSubscriber()->getHelpURL();
                     $email = $this->person->getSubscriber()->getHelpEmail();
                     $msg .= "<br />\n";
                     $msg .= $this->contentPage->translateMessageTag('fw_error_entitlement_unset_3');
                     $msg .= '<br /><ul><li style="margin: 1em 0 0 2em">';
                     $msg .= $this->contentPage->translateMessageTag('fw_error_entitlement_unset_4');
                     $msg .= "<a href=\"mailto:{$email}\">{$email}</a></li>";
                     $msg .= '<li style="margin: 1em 0 0 2em">';
                     $msg .= $this->contentPage->translateMessageTag('fw_error_entitlement_unset_5');
                     $msg .= "<a href=\"{$url}\">{$url}</a></li>\n</ul><br />\n";
                 }
                 Framework::error_output($msg);
             } else {
                 $entitlement = Config::get_config('entitlement_namespace') . ":";
                 $entitlement = Config::get_config('entitlement_user');
                 $msg = $this->contentPage->translateMessageTag('fw_error_entitlement_unset_1');
                 $msg .= "<br /><i>{$entitlement}</i><br /><br />";
                 $msg .= $this->contentPage->translateMessageTag('fw_error_entitlement_unset_6');
                 Framework::warning_output($msg);
             }
         }
     } else {
         /* maybe we can guess the NREN from the URL */
         $this->person->setNREN(NREN_Handler::getNREN($_SERVER['SERVER_NAME']), 1);
     }
     /*
      * Force reauthentication based on the settings if the session is too
      * old */
     if (Framework::$sensitive_action) {
         $auth->reAuthenticate();
     }
 }