本文整理汇总了PHP中SimpleSAML_Auth_Source::getSources方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Auth_Source::getSources方法的具体用法?PHP SimpleSAML_Auth_Source::getSources怎么用?PHP SimpleSAML_Auth_Source::getSources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSAML_Auth_Source
的用法示例。
在下文中一共展示了SimpleSAML_Auth_Source::getSources方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SimpleSAML_XHTML_Template
<?php
$config = SimpleSAML_Configuration::getInstance();
if (!array_key_exists('as', $_REQUEST)) {
$t = new SimpleSAML_XHTML_Template($config, 'core:authsource_list.tpl.php');
$t->data['sources'] = SimpleSAML_Auth_Source::getSources();
$t->show();
exit;
}
$asId = (string) $_REQUEST['as'];
$as = new SimpleSAML_Auth_Simple($asId);
if (array_key_exists('logout', $_REQUEST)) {
$as->logout('/' . $config->getBaseURL() . 'logout.php');
}
if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) {
// This is just a simple example of an error
$state = SimpleSAML_Auth_State::loadExceptionState();
assert('array_key_exists(SimpleSAML_Auth_State::EXCEPTION_DATA, $state)');
$e = $state[SimpleSAML_Auth_State::EXCEPTION_DATA];
header('Content-Type: text/plain');
echo "Exception during login:\n";
foreach ($e->format() as $line) {
echo $line . "\n";
}
exit(0);
}
if (!$as->isAuthenticated()) {
$url = SimpleSAML_Module::getModuleURL('core/authenticate.php', array('as' => $asId));
$params = array('ErrorURL' => $url, 'ReturnTo' => $url);
$as->login($params);
}
示例2: SimpleSAML_Auth_Simple
// get all the things that we will need from the SAML authentication
// and then shutdown the session control
SimpleSAML_Configuration::init($samlconfig);
$saml_session = SimpleSAML_Session::getInstance();
// do we have a logout request?
if (param_variable("logout", false)) {
// logout the saml session
$sp = $saml_session->getAuthority();
if (!$sp) {
$sp = 'default-sp';
}
$as = new SimpleSAML_Auth_Simple($sp);
$as->logout($CFG->wwwroot);
}
$sp = param_alphanumext('as', 'default-sp');
if (!in_array($sp, SimpleSAML_Auth_Source::getSources())) {
$sp = 'default-sp';
}
$as = new SimpleSAML_Auth_Simple($sp);
// Check the SimpleSAMLphp config is compatible
$saml_config = SimpleSAML_Configuration::getInstance();
$session_handler = $saml_config->getString('session.handler', false);
$store_type = $saml_config->getString('store.type', false);
if ($store_type == 'phpsession' || $session_handler == 'phpsession' || empty($store_type) && empty($session_handler)) {
throw new AuthInstanceException(get_string('errorbadssphp', 'auth.saml'));
}
// what is the session like?
$valid_saml_session = $saml_session->isValid($sp);
// figure out what the returnto URL should be
$wantsurl = param_variable("wantsurl", false);
if (!$wantsurl) {
示例3: foreach
echo $key;
?>
</td>
<td><?php
echo $value[0];
?>
</td>
</tr>
<?php
}
?>
</table>
</div>
<?php
} else {
$sources = SimpleSAML_Auth_Source::getSources();
?>
<p class="lead">Select the IdP you want to use to authenticate:</p>
<ol>
<?php
foreach ($sources as $source) {
?>
<li><a href="?<?php
echo $saml_sso;
?>
=<?php
echo $source;
?>
"><?php
echo $source;
?>