getOptionalConfig() 공개 정적인 메소드

This function will return a configuration object even if the file does not exist.
public static getOptionalConfig ( string $filename = 'config.php', string $configSet = 'simplesaml' ) : SimpleSAML_Configuration
$filename string The name of the configuration file.
$configSet string The configuration set. Optional, defaults to 'simplesaml'.
리턴 SimpleSAML_Configuration A configuration object.
예제 #1
0
 /**
  * Determine whether a module is enabled.
  *
  * Will return false if the given module doesn't exists.
  *
  * @param string $module Name of the module
  *
  * @return bool True if the given module is enabled, false otherwise.
  *
  * @throws Exception If module.enable is set and is not boolean.
  */
 public static function isModuleEnabled($module)
 {
     $moduleDir = self::getModuleDir($module);
     if (!is_dir($moduleDir)) {
         return false;
     }
     $globalConfig = SimpleSAML_Configuration::getOptionalConfig();
     $moduleEnable = $globalConfig->getArray('module.enable', array());
     if (isset($moduleEnable[$module])) {
         if (is_bool($moduleEnable[$module]) === true) {
             return $moduleEnable[$module];
         }
         throw new Exception("Invalid module.enable value for for the module {$module}");
     }
     if (assert_options(ASSERT_ACTIVE) && !file_exists($moduleDir . '/default-enable') && !file_exists($moduleDir . '/default-disable')) {
         SimpleSAML_Logger::error("Missing default-enable or default-disable file for the module {$module}");
     }
     if (file_exists($moduleDir . '/enable')) {
         return true;
     }
     if (!file_exists($moduleDir . '/disable') && file_exists($moduleDir . '/default-enable')) {
         return true;
     }
     return false;
 }
예제 #2
0
/**
 * Hook to inject HTML content into all pages...
 *
 * @param array &$hookinfo  hookinfo
 */
function portal_hook_htmlinject(&$hookinfo)
{
    assert('is_array($hookinfo)');
    assert('array_key_exists("pre", $hookinfo)');
    assert('array_key_exists("post", $hookinfo)');
    assert('array_key_exists("page", $hookinfo)');
    $links = array('links' => array());
    SimpleSAML_Module::callHooks('frontpage', $links);
    $portalConfig = SimpleSAML_Configuration::getOptionalConfig('module_portal.php');
    $allLinks = array();
    foreach ($links as $ls) {
        $allLinks = array_merge($allLinks, $ls);
    }
    $pagesets = $portalConfig->getValue('pagesets', array(array('frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation')));
    SimpleSAML_Module::callHooks('portalextras', $pagesets);
    $portal = new sspmod_portal_Portal($allLinks, $pagesets);
    if (!$portal->isPortalized($hookinfo['page'])) {
        return;
    }
    // Include jquery UI CSS files in header.
    $hookinfo['jquery']['css'] = TRUE;
    $hookinfo['jquery']['version'] = '1.6';
    // Header
    $hookinfo['pre'][] = '<div id="portalmenu" class="ui-tabs ui-widget ui-widget-content ui-corner-all">' . $portal->getMenu($hookinfo['page']) . '<div id="portalcontent" class="ui-tabs-panel ui-widget-content ui-corner-bottom">';
    // Footer
    $hookinfo['post'][] = '</div></div>';
}
예제 #3
0
/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function sanitycheck_hook_cron(&$croninfo)
{
    assert('is_array($croninfo)');
    assert('array_key_exists("summary", $croninfo)');
    assert('array_key_exists("tag", $croninfo)');
    SimpleSAML_Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] ');
    try {
        $sconfig = SimpleSAML_Configuration::getOptionalConfig('config-sanitycheck.php');
        $cronTag = $sconfig->getString('cron_tag', NULL);
        if ($cronTag === NULL || $cronTag !== $croninfo['tag']) {
            return;
        }
        $info = array();
        $errors = array();
        $hookinfo = array('info' => &$info, 'errors' => &$errors);
        SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);
        if (count($errors) > 0) {
            foreach ($errors as $err) {
                $croninfo['summary'][] = 'Sanitycheck error: ' . $err;
            }
        }
    } catch (Exception $e) {
        $croninfo['summary'][] = 'Error executing sanity check: ' . $e->getMessage();
    }
}
function oauth2_hook_cron(&$croninfo)
{
    assert('is_array($croninfo)');
    assert('array_key_exists("summary", $croninfo)');
    assert('array_key_exists("tag", $croninfo)');
    $oauth2config = SimpleSAML_Configuration::getOptionalConfig('module_oauth2.php');
    if (is_null($oauth2config->getValue('cron_tag', 'hourly'))) {
        return;
    }
    if ($oauth2config->getValue('cron_tag', NULL) !== $croninfo['tag']) {
        return;
    }
    try {
        $store = SimpleSAML_Store::getInstance();
        if (!$store instanceof \SimpleSAML\Modules\DBAL\Store\DBAL) {
            throw new \SimpleSAML_Error_Exception('OAuth2 module: Only DBAL Store is supported');
        }
        $accessTokenRepository = new AccessTokenRepository();
        $accessTokenRepository->removeExpiredAccessTokens();
        $authTokenRepository = new AuthCodeRepository();
        $authTokenRepository->removeExpiredAuthCodes();
        $refreshTokenRepository = new RefreshTokenRepository();
        $refreshTokenRepository->removeExpiredRefreshTokens();
        $croninfo['summary'][] = 'OAuth2 clean up. Removed expired entries from OAuth2 storage.';
    } catch (Exception $e) {
        $message = 'OAuth2 clean up cron script failed: ' . $e->getMessage();
        SimpleSAML\Logger::warning($message);
        $croninfo['summary'][] = $message;
    }
}
 /**
  * ClientRepository constructor.
  */
 public function __construct()
 {
     $this->config = \SimpleSAML_Configuration::getOptionalConfig('module_oauth2.php');
     $this->store = \SimpleSAML_Store::getInstance();
     if (!$this->store instanceof DBAL) {
         throw new \SimpleSAML_Error_Exception('OAuth2 module: Only DBAL Store is supported');
     }
     $this->conn = $this->store->getConnection();
 }
예제 #6
0
 /**
  * Retrieve an access control list with the given id.
  *
  * @param string $id  The id of the access control list.
  * @return array  The access control list array.
  */
 private static function getById($id)
 {
     assert('is_string($id)');
     $config = SimpleSAML_Configuration::getOptionalConfig('acl.php');
     if (!$config->hasValue($id)) {
         throw new SimpleSAML_Error_Exception('No ACL with id ' . var_export($id, TRUE) . ' in config/acl.php.');
     }
     return $config->getArray($id);
 }
예제 #7
0
/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function metarefresh_hook_cron(&$croninfo)
{
    assert('is_array($croninfo)');
    assert('array_key_exists("summary", $croninfo)');
    assert('array_key_exists("tag", $croninfo)');
    SimpleSAML_Logger::info('cron [metarefresh]: Running cron in cron tag [' . $croninfo['tag'] . '] ');
    try {
        $config = SimpleSAML_Configuration::getInstance();
        $mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php');
        $sets = $mconfig->getConfigList('sets', array());
        foreach ($sets as $setkey => $set) {
            // Only process sets where cron matches the current cron tag.
            $cronTags = $set->getArray('cron');
            if (!in_array($croninfo['tag'], $cronTags)) {
                continue;
            }
            SimpleSAML_Logger::info('cron [metarefresh]: Executing set [' . $setkey . ']');
            $expireAfter = $set->getInteger('expireAfter', NULL);
            if ($expireAfter !== NULL) {
                $expire = time() + $expireAfter;
            } else {
                $expire = NULL;
            }
            $metaloader = new sspmod_metarefresh_MetaLoader($expire);
            foreach ($set->getArray('sources') as $source) {
                SimpleSAML_Logger::debug('cron [metarefresh]: In set [' . $setkey . '] loading source [' . $source['src'] . ']');
                $metaloader->loadSource($source);
            }
            $outputDir = $set->getString('outputDir');
            $outputDir = $config->resolvePath($outputDir);
            $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile');
            switch ($outputFormat) {
                case 'flatfile':
                    $metaloader->writeMetadataFiles($outputDir);
                    break;
                case 'serialize':
                    $metaloader->writeMetadataSerialize($outputDir);
                    break;
            }
            if ($set->hasValue('arp')) {
                $arpconfig = SimpleSAML_Configuration::loadFromArray($set->getValue('arp'));
                $metaloader->writeARPfile($arpconfig);
            }
        }
    } catch (Exception $e) {
        $croninfo['summary'][] = 'Error during metarefresh: ' . $e->getMessage();
    }
}
예제 #8
0
	public static function show($path = '/simplesaml/module.php/discojuice/discojuice/') {
			
		$djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuicecentral.php');
		$config = SimpleSAML_Configuration::getInstance();
		
		
		$feed = new sspmod_discojuice_Feed();
		$metadata = json_decode($feed->read(), TRUE);	
		
		$t = new SimpleSAML_XHTML_Template($config, 'discojuice:central.tpl.php');
		$t->data['metadata'] = $metadata;
		$t->data['discojuice.options'] = $djconfig->getValue('discojuice.options');
		$t->data['discojuice.options']['discoPath'] = $path;
		$t->data['acl'] = $djconfig->getValue('acl');
		$t->show();
		
	}
예제 #9
0
/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function oauth_hook_cron(&$croninfo)
{
    assert('is_array($croninfo)');
    assert('array_key_exists("summary", $croninfo)');
    assert('array_key_exists("tag", $croninfo)');
    $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_statistics.php');
    if (is_null($oauthconfig->getValue('cron_tag', 'hourly'))) {
        return;
    }
    if ($oauthconfig->getValue('cron_tag', NULL) !== $croninfo['tag']) {
        return;
    }
    try {
        $store = new sspmod_core_Storage_SQLPermanentStorage('oauth');
        $cleaned = $store->removeExpired();
        #		if ($cleaned > 0)
        $croninfo['summary'][] = 'OAuth clean up. Removed ' . $cleaned . ' expired entries from OAuth storage.';
    } catch (Exception $e) {
        $message = 'OAuth clean up cron script failed: ' . $e->getMessage();
        SimpleSAML_Logger::warning($message);
        $croninfo['summary'][] = $message;
    }
}
예제 #10
0
	public static function head($includeJQuery = TRUE) {
		
		$version = '0.1-4';
		
		$config = SimpleSAML_Configuration::getInstance();
		$djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuiceembed.php');
		
			
		if ($includeJQuery) {	
			echo '
<!-- JQuery (Required for DiscoJuice) -->
	<script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/jquery-1.6.min.js') . '"></script>
	<script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/jquery-ui-1.8.5.custom.min.js') . '"></script>
			
	<link rel="stylesheet" type="text/css" href="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/css/custom/jquery-ui-1.8.5.custom.css') . '" />

';

		}
		
		
		echo '
<!-- DiscoJuice (version identifier: ' . $version . ' ) -->
	<script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.misc.js?v=' . $version) . '"></script>
	<script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.ui.js?v=' . $version) . '"></script>
	<script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.control.js?v=' . $version) . '"></script>
		
	<link rel="stylesheet" type="text/css" href="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/css/discojuice.css?v=' . $version) . '" />

';
	
		
		$options = $djconfig->getValue('discojuice.options');
		$target = $djconfig->getValue('target');
		

		echo '<script type="text/javascript">';
		echo 'var options = ' . json_encode($options) . ';' . "\n";
		echo 'var target = "' . $target . '";' . "\n\n";
		
		echo 'options.countryAPI = "' . SimpleSAML_Module::getModuleURL('discojuice/country.php'). '"; ' . "\n";
		
		if (empty($options['metadata'])) {
			echo 'options.metadata = "' . SimpleSAML_Module::getModuleURL('discojuice/feed.php'). '"; ' . "\n";
		}
		
		if (!empty($options['disco'])) {
			echo 'options.disco.url = "' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuiceDiscoveryResponse.html?'). '"; ' . "\n";
		}


		echo 'options.discoPath = "' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/') . '"; ' . "\n";
		
		
		echo 'options.callback = ' . $djconfig->getValue('callback', 'null') . ';' . "\n\n";
			

		echo '
			$(document).ready(function() {
				$(target).DiscoJuice(options);
			});
		</script>
		
		';
		
		
	}
예제 #11
0
 /**
  * Retrieve list of authentication sources.
  *
  * @param string $authId  The authentication source identifier.
  * @return array  The id of all authentication sources.
  */
 public static function getSources()
 {
     $config = SimpleSAML_Configuration::getOptionalConfig('authsources.php');
     return $config->getOptions();
 }
예제 #12
0
<?php

$config = SimpleSAML_Configuration::getInstance();
$mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php');
SimpleSAML\Utils\Auth::requireAdmin();
SimpleSAML_Logger::setCaptureLog(TRUE);
$sets = $mconfig->getConfigList('sets', array());
foreach ($sets as $setkey => $set) {
    SimpleSAML_Logger::info('[metarefresh]: Executing set [' . $setkey . ']');
    try {
        $expireAfter = $set->getInteger('expireAfter', NULL);
        if ($expireAfter !== NULL) {
            $expire = time() + $expireAfter;
        } else {
            $expire = NULL;
        }
        $metaloader = new sspmod_metarefresh_MetaLoader($expire);
        # Get global black/whitelists
        $blacklist = $mconfig->getArray('blacklist', array());
        $whitelist = $mconfig->getArray('whitelist', array());
        // get global type filters
        $available_types = array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote', 'attributeauthority-remote');
        $set_types = $set->getArrayize('types', $available_types);
        foreach ($set->getArray('sources') as $source) {
            // filter metadata by type of entity
            if (isset($source['types'])) {
                $metaloader->setTypes($source['types']);
            } else {
                $metaloader->setTypes($set_types);
            }
            # Merge global and src specific blacklists
예제 #13
0
파일: GepiSimple.php 프로젝트: rhertzog/lcs
	/**
	 * retourne la configuration de la source réelle utilisée pour l'authentification
	 *
	 * @return array
	 */
	protected function getChosenSourceConfig() {
		//si on est en multiauth, il va y avoir une délégation de source
		//on va donc regarder la configuration de la source choisie par l'utilisateur
		if($this->authSourceConfig[0] != 'multiauth:MultiAuth') {
			return $this->authSourceConfig;
		} else {
			$session = SimpleSAML_Session::getInstance();
			$delegationAuthId = $session->getData(sspmod_multiauth_Auth_Source_MultiAuth::SESSION_SOURCE, $this->authSource);
			if ($delegationAuthId == null) {
				//aucune source choisie pour l'instant par l'utilisateur
				return $this->authSourceConfig;
			}
			$config = SimpleSAML_Configuration::getOptionalConfig('authsources.php');
			return $config->getArray($delegationAuthId);
		}
	}
예제 #14
0
/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function metarefresh_hook_cron(&$croninfo)
{
    assert('is_array($croninfo)');
    assert('array_key_exists("summary", $croninfo)');
    assert('array_key_exists("tag", $croninfo)');
    SimpleSAML_Logger::info('cron [metarefresh]: Running cron in cron tag [' . $croninfo['tag'] . '] ');
    try {
        $config = SimpleSAML_Configuration::getInstance();
        $mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php');
        $sets = $mconfig->getConfigList('sets', array());
        $stateFile = $config->getPathValue('datadir', 'data/') . 'metarefresh-state.php';
        foreach ($sets as $setkey => $set) {
            // Only process sets where cron matches the current cron tag.
            $cronTags = $set->getArray('cron');
            if (!in_array($croninfo['tag'], $cronTags)) {
                continue;
            }
            SimpleSAML_Logger::info('cron [metarefresh]: Executing set [' . $setkey . ']');
            $expireAfter = $set->getInteger('expireAfter', NULL);
            if ($expireAfter !== NULL) {
                $expire = time() + $expireAfter;
            } else {
                $expire = NULL;
            }
            $outputDir = $set->getString('outputDir');
            $outputDir = $config->resolvePath($outputDir);
            $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile');
            $oldMetadataSrc = SimpleSAML_Metadata_MetaDataStorageSource::getSource(array('type' => $outputFormat, 'directory' => $outputDir));
            $metaloader = new sspmod_metarefresh_MetaLoader($expire, $stateFile, $oldMetadataSrc);
            # Get global blacklist, whitelist and caching info
            $blacklist = $mconfig->getArray('blacklist', array());
            $whitelist = $mconfig->getArray('whitelist', array());
            $conditionalGET = $mconfig->getBoolean('conditionalGET', FALSE);
            // get global type filters
            $available_types = array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote', 'attributeauthority-remote');
            $set_types = $set->getArrayize('types', $available_types);
            foreach ($set->getArray('sources') as $source) {
                // filter metadata by type of entity
                if (isset($source['types'])) {
                    $metaloader->setTypes($source['types']);
                } else {
                    $metaloader->setTypes($set_types);
                }
                # Merge global and src specific blacklists
                if (isset($source['blacklist'])) {
                    $source['blacklist'] = array_unique(array_merge($source['blacklist'], $blacklist));
                } else {
                    $source['blacklist'] = $blacklist;
                }
                # Merge global and src specific whitelists
                if (isset($source['whitelist'])) {
                    $source['whitelist'] = array_unique(array_merge($source['whitelist'], $whitelist));
                } else {
                    $source['whitelist'] = $whitelist;
                }
                # Let src specific conditionalGET override global one
                if (!isset($source['conditionalGET'])) {
                    $source['conditionalGET'] = $conditionalGET;
                }
                SimpleSAML_Logger::debug('cron [metarefresh]: In set [' . $setkey . '] loading source [' . $source['src'] . ']');
                $metaloader->loadSource($source);
            }
            // Write state information back to disk
            $metaloader->writeState();
            switch ($outputFormat) {
                case 'flatfile':
                    $metaloader->writeMetadataFiles($outputDir);
                    break;
                case 'serialize':
                    $metaloader->writeMetadataSerialize($outputDir);
                    break;
            }
            if ($set->hasValue('arp')) {
                $arpconfig = SimpleSAML_Configuration::loadFromArray($set->getValue('arp'));
                $metaloader->writeARPfile($arpconfig);
            }
        }
    } catch (Exception $e) {
        $croninfo['summary'][] = 'Error during metarefresh: ' . $e->getMessage();
    }
}
예제 #15
0
<?php

/* Load simpleSAMLphp, configuration and metadata */
$config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getSessionFromRequest();
$oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php');
$store = new sspmod_core_Storage_SQLPermanentStorage('oauth');
//$authsource = $oauthconfig->getValue('auth', 'admin');
$authsource = "admin";
// force admin to authenticate as registry maintainer
$useridattr = $oauthconfig->getValue('useridattr', 'user');
//$useridattr = $oauthconfig->getValue('useridattr', 'uid');
if ($session->isValid($authsource)) {
    $attributes = $session->getAttributes();
    // Check if userid exists
    if (!isset($attributes[$useridattr])) {
        throw new Exception('User ID is missing');
    }
    $userid = $attributes[$useridattr][0];
} else {
    SimpleSAML_Auth_Default::initLogin($authsource, SimpleSAML_Utilities::selfURL());
}
function requireOwnership($entry, $userid)
{
    if (!isset($entry['owner'])) {
        throw new Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.');
    }
    if ($entry['owner'] !== $userid) {
        throw new Exception('OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.');
    }
}
예제 #16
0
if (!$ldap_setup_valid) {
    echo " <em>(sélection impossible : le fichier /secure/config_ldap.inc.php n'est pas présent)</em>\n";
}
echo "</label>\n";
//on va voir si il y a simplesaml de configuré
if (file_exists(dirname(__FILE__) . '/../lib/simplesaml/config/authsources.php')) {
    echo "<br/><input type='checkbox' name='auth_simpleSAML' value='yes' id='label_auth_simpleSAML'";
    if (getSettingValue("auth_simpleSAML") == 'yes') {
        echo " checked ";
    }
    echo " /> <label for='label_auth_simpleSAML' style='cursor: pointer;'>Authentification simpleSAML";
    echo "</label>\n";
    echo "<br/>\n<select name=\"auth_simpleSAML_source\" size=\"1\">\n";
    echo "<option value='unset'></option>";
    include_once dirname(__FILE__) . '/../lib/simplesaml/lib/_autoload.php';
    $config = SimpleSAML_Configuration::getOptionalConfig('authsources.php');
    $sources = $config->getOptions();
    foreach ($sources as $source) {
        echo "<option value='{$source}'";
        if ($source == getSettingValue("auth_simpleSAML_source")) {
            echo 'selected';
        }
        echo ">";
        echo $source;
        echo "</option>";
    }
    echo "</select>\n";
} else {
    echo "<input type='hidden' name='auth_simpleSAML' value='no' />";
}
echo "</p>\n";
예제 #17
0
 function __construct()
 {
     $this->store = new sspmod_core_Storage_SQLPermanentStorage('oauth');
     $this->config = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php');
     $this->defaultversion = $this->config->getValue('defaultversion', '1.0');
 }
예제 #18
0
파일: Feed.php 프로젝트: rhertzog/lcs
	function __construct() {
	
		$this->config = SimpleSAML_Configuration::getInstance();
		$this->djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuicefeed.php');

		$metadatah = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
		
		$saml2 = $metadatah->getList('saml20-idp-remote');
		$shib = $metadatah->getList('shib13-idp-remote');
		
		foreach($shib AS $s) {
			$this->metadata[$s['entityid']] = $s;
		}
		foreach($saml2 AS $s) {
			$this->metadata[$s['entityid']] = $s;
		}
		// $this->metadata = array_merge($this->metadata, $shib);
		
		
		$this->idplist = $this->getIdPList();
		
		SimpleSAML_Logger::info('IdP List contained : ' . count($this->idplist)  . ' entries.');
		
		$this->excludes = array_flip($this->djconfig->getValue('exclude'));
		$this->insert = $this->djconfig->getValue('insert');
		$this->overrides = $this->djconfig->getValue('overrides');
		
		$this->countrytags = array(
			'croatia' => 'HR',
			'czech' => 'CZ',
			'denmark' => 'DK',
			'finland' => 'FI',
			'france' => 'FR',
			'germany' => 'DE',
			'greece' => 'GR',
			'ireland' => 'IE',
			'italy' => 'IT',
			'luxembourg' => 'LU',
			'hungary' => 'HU',
			'netherlands' => 'NL',
			'norway' => 'NO',
			'portugal' => 'PT',
			'poland' => 'PL',
			'slovenia' => 'SI',
			'spain' => 'ES',
			'sweden' => 'SE',
			'switzerland' => 'CH',
			'turkey' => 'TR',
			'us' => 'US',
			'uk' => 'GB',
			'japan'  => 'JP',
		);
		
		$this->countryTLDs = array(
			'lp.' => 'PL',
			'uh.' => 'HU',
			'es.' => 'SE',
			'ed.' => 'DE',
			'if.' => 'FI',
			'zc.' => 'CZ',
			'rt.' => 'TR',
			'kd.' => 'DK',
			'on.' => 'NO',
			'ude.' => 'US',
			'ku.oc.' => 'GB',
		);
	}
예제 #19
0
 function __construct()
 {
     $this->store = new sspmod_core_Storage_SQLPermanentStorage('oauth');
     $this->config = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php');
 }
            /* In case of challenge response we do not change the username */
            $state['forcedUsername'] = $username;
            $transaction_id = $errorParams[1];
            $message = $errorParams[2];
            $attributes = $errorParams[3];
            SimpleSAML_Logger::debug("Challenge Response transaction_id: " . $errorParams[1]);
            SimpleSAML_Logger::debug("Challenge Response message: " . $errorParams[2]);
            SimpleSAML_Logger::debug("CHallenge Response attributes: " . print_r($attributes, TRUE));
        }
    }
}
$globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'privacyidea:loginform.php');
$t->data['stateparams'] = array('AuthState' => $authStateId);
// Determine the login mode
$authConfig = SimpleSAML_Configuration::getOptionalConfig("authsources.php");
$privacyideaConfig = array();
$keys = $authConfig->getOptions();
foreach ($keys as $key) {
    $config = $authConfig->getValue($key);
    if ($config[0] == "privacyidea:privacyidea") {
        $privacyideaConfig = $config;
    }
}
$pi = new sspmod_privacyidea_Auth_Source_privacyidea(array(), $privacyideaConfig);
$t->data['otp_extra'] = $pi->getOtpExtra();
if (array_key_exists('forcedUsername', $state)) {
    $t->data['username'] = $state['forcedUsername'];
    $t->data['transaction_id'] = $transaction_id;
    $t->data['chal_resp_message'] = $message;
    $t->data['chal_resp_attributes'] = $attributes;
예제 #21
0
<?php

if (empty($_REQUEST['entityID'])) {
    throw new Exception('Missing parameter [entityID]');
}
if (empty($_REQUEST['return'])) {
    throw new Exception('Missing parameter [return]');
}
$djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuice.php');
$config = SimpleSAML_Configuration::getInstance();
// EntityID
$entityid = $_REQUEST['entityID'];
// Return to...
$returnidparam = !empty($_REQUEST['returnIDParam']) ? $_REQUEST['returnIDParam'] : 'entityID';
$href = SimpleSAML_Utilities::addURLparameter($_REQUEST['return'], array($returnidparam => ''));
$hostedConfig = array($djconfig->getString('name', 'Service'), $entityid, SimpleSAML_Module::getModuleURL('discojuice/response.html'), $djconfig->getArray('feeds', array('edugain')), $href);
/*
	"a.signin", "Teest Demooo",
    "https://example.org/saml2/entityid",
    "' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuiceDiscoveryResponse.html') . '", ["kalmar"], "http://example.org/login?idp="
*/
$t = new SimpleSAML_XHTML_Template($config, 'discojuice:central.tpl.php');
$t->data['hostedConfig'] = $hostedConfig;
$t->data['enableCentralStorage'] = $djconfig->getBoolean('enableCentralStorage', true);
$t->data['additionalFeeds'] = $djconfig->getArray('additionalFeeds', null);
$t->show();
 /**
  * Test SimpleSAML_Configuration::getVersion()
  */
 public function testGetVersion()
 {
     $c = SimpleSAML_Configuration::getOptionalConfig();
     $this->assertTrue(is_string($c->getVersion()));
 }