本文整理汇总了PHP中SimpleSAML_Auth_Simple::getAuthSource方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Auth_Simple::getAuthSource方法的具体用法?PHP SimpleSAML_Auth_Simple::getAuthSource怎么用?PHP SimpleSAML_Auth_Simple::getAuthSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSAML_Auth_Simple
的用法示例。
在下文中一共展示了SimpleSAML_Auth_Simple::getAuthSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reauthenticate
/**
* Re-authenticate the user.
*
* This function re-authenticates an user with an existing session. This gives the authentication source a chance
* to do additional work when re-authenticating for SSO.
*
* Note: This function is not used when ForceAuthn=true.
*
* @param array &$state The authentication request state.
*
* @throws SimpleSAML_Error_Exception If there is no auth source defined for this IdP.
*/
private function reauthenticate(array &$state)
{
$sourceImpl = $this->authSource->getAuthSource();
if ($sourceImpl === null) {
throw new SimpleSAML_Error_Exception('No such auth source defined.');
}
$sourceImpl->reauthenticate($state);
}
示例2: reauthenticate
/**
* Reuthenticate the user.
*
* This function reauthenticates an user with an existing session. This
* gives the authentication source a chance to do additional work when
* reauthenticating for SSO.
*
* Note: This function is not used when ForceAuthn=true.
*
* @param array &$state The authentication request state.
*/
private function reauthenticate(array &$state)
{
$sourceImpl = $this->authSource->getAuthSource();
if ($sourceImpl === NULL) {
/* Backwards-compatibility with non-authsource IdP. */
foreach ($this->authSource->getAuthDataArray() as $k => $v) {
$state[$k] = $v;
}
return;
}
$sourceImpl->reauthenticate($state);
}
示例3: simplesaml_get_authentication_attributes
/**
* Get the attributes from an SAML authentication exchange.
*
* These attributes can include all kinds of information, for example:
* - firstname
* - lastname
* - email address
* - etc.
*
* @param SimpleSAML_Auth_Simple $saml_auth the Authentication object from the SimpleSAMLPHP library
* @param string $source the name of the Service Provider
*
* @return bool|array an array with the provided attributes, false on failure
*/
function simplesaml_get_authentication_attributes(SimpleSAML_Auth_Simple $saml_auth, $source)
{
$result = false;
if (!empty($saml_auth) && $saml_auth instanceof SimpleSAML_Auth_Simple && !empty($source)) {
$result = $saml_auth->getAttributes();
$auth_source = $saml_auth->getAuthSource();
if ($auth_source instanceof sspmod_saml_Auth_Source_SP) {
// only check extra data for SAML sources
$setting = elgg_get_plugin_setting($source . "_external_id", "simplesaml");
if (!empty($setting)) {
$external_id = $saml_auth->getAuthData($setting);
if (!empty($external_id)) {
$result["elgg:external_id"] = array($external_id["Value"]);
}
}
}
}
return $result;
}
示例4: isset
<?php
//require_once('/var/simplesamlphp/lib/_autoload.php');
require_once 'c:/simplesaml/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('mewSQLAuth');
$as->requireAuth();
//$as = new SimpleSAML_Auth_Simple('mewSQLStatic');
//$as->requireAuth( array('saml:idp' => 'http://localhost/simplesaml') );
////$as->requireAuth( array('KeepPost' => TRUE, 'loginNames' => $_GET['loginNames']));
$attributes[] = $as->getAttributes();
$authSource = $as->getAuthSource();
$session = SimpleSAML_Session::getInstance();
//$session->doLogout($authSource);
//$as->logout(array());
$json = json_encode($attributes);
header('Content-type: application/json; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 1 Jan 1990 00:00:00 GMT');
print isset($_GET['callback']) ? "{$_GET['callback']}({$json})" : $json;