Ejemplo n.º 1
0
        SimpleSAML_Logger::debug('Statistics auth - valid login with auth source [' . $authsource . ']');
        // Retrieving attributes
        $attributes = $session->getAttributes();
        // Check if userid exists
        if (!isset($attributes[$useridattr])) {
            throw new Exception('User ID is missing');
        }
        // Check if userid is allowed access..
        if (!in_array($attributes[$useridattr][0], $allowedusers)) {
            SimpleSAML_Logger::debug('Statistics auth - User denied access by user ID [' . $attributes[$useridattr][0] . ']');
            throw new Exception('Access denied for this user.');
        }
        SimpleSAML_Logger::debug('Statistics auth - User granted access by user ID [' . $attributes[$useridattr][0] . ']');
    } elseif (isset($authsource)) {
        // If user is not logged in init login with authrouce if authsousrce is defined.
        SimpleSAML_Auth_Default::initLogin($authsource, SimpleSAML_Utilities::selfURL());
    } else {
        // If authsource is not defined, init admin login.
        SimpleSAML_Utilities::requireAdmin();
    }
}
$aggr = new sspmod_statistics_Aggregator();
$aggr->loadMetadata();
$metadata = $aggr->getMetadata();
// echo('<pre>'); print_r($metadata);
/**
 * AUTHENTICATION and Authorization for access to the statistics.  ------
 */
$t = new SimpleSAML_XHTML_Template($config, 'statistics:statmeta-tpl.php');
$t->data['metadata'] = $metadata;
$t->show();