SimpleSAML_IdP::handleAuthenticationRequest PHP Méthode

handleAuthenticationRequest() public méthode

Process authentication requests.
public handleAuthenticationRequest ( array &$state )
$state array
    public function handleAuthenticationRequest(array &$state)
    {
        assert('isset($state["Responder"])');
        $state['core:IdP'] = $this->id;
        if (isset($state['SPMetadata']['entityid'])) {
            $spEntityId = $state['SPMetadata']['entityid'];
        } elseif (isset($state['SPMetadata']['entityID'])) {
            $spEntityId = $state['SPMetadata']['entityID'];
        } else {
            $spEntityId = null;
        }
        $state['core:SP'] = $spEntityId;
        // first, check whether we need to authenticate the user
        if (isset($state['ForceAuthn']) && (bool) $state['ForceAuthn']) {
            // force authentication is in effect
            $needAuth = true;
        } else {
            $needAuth = !$this->isAuthenticated();
        }
        $state['IdPMetadata'] = $this->getConfig()->toArray();
        $state['ReturnCallback'] = array('SimpleSAML_IdP', 'postAuth');
        try {
            if ($needAuth) {
                $this->authenticate($state);
                assert('FALSE');
            } else {
                $this->reauthenticate($state);
            }
            $this->postAuth($state);
        } catch (SimpleSAML_Error_Exception $e) {
            SimpleSAML_Auth_State::throwException($state, $e);
        } catch (Exception $e) {
            $e = new SimpleSAML_Error_UnserializableException($e);
            SimpleSAML_Auth_State::throwException($state, $e);
        }
    }

Usage Example

Exemple #1
0
 public static function receiveAuthnRequest(SimpleSAML_IdP $idp)
 {
     try {
         // accomodate for disfunctional $_GET "windows" slash decoding in PHP
         $wctx = $_GET['wctx'];
         foreach (explode('&', $_SERVER['REQUEST_URI']) as $e) {
             $a = explode('=', $e);
             if ($a[0] == 'wctx') {
                 $wctx = urldecode($a[1]);
             }
         }
         $requestid = $wctx;
         $issuer = $_GET['wtrealm'];
         $requestcache = array('RequestID' => $requestid, 'Issuer' => $issuer, 'RelayState' => $requestid);
         $spEntityId = $requestcache['Issuer'];
         $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
         $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'adfs-sp-remote');
         SimpleSAML_Logger::info('ADFS - IdP.prp: Incoming Authentication request: ' . $issuer . ' id ' . $requestid);
     } catch (Exception $exception) {
         throw new SimpleSAML_Error_Error('PROCESSAUTHNREQUEST', $exception);
     }
     $sessionLostURL = NULL;
     // TODO?
     $forceAuthn = FALSE;
     $isPassive = FALSE;
     $state = array('Responder' => array('sspmod_adfs_IdP_ADFS', 'sendResponse'), 'SPMetadata' => $spMetadata->toArray(), 'ForceAuthn' => $forceAuthn, 'isPassive' => $isPassive, 'adfs:wctx' => $wctx);
     $idp->handleAuthenticationRequest($state);
 }
All Usage Examples Of SimpleSAML_IdP::handleAuthenticationRequest