getAuthSource() public method

Retrieve the implementing authentication source.
public getAuthSource ( ) : SimpleSAML_Auth_Source
return SimpleSAML_Auth_Source The authentication source.
Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * 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);
 }
Example #3
0
/**
 * 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;
}
Example #4
0
<?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;