当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleSAML_Utilities::checkCookie方法代码示例

本文整理汇总了PHP中SimpleSAML_Utilities::checkCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Utilities::checkCookie方法的具体用法?PHP SimpleSAML_Utilities::checkCookie怎么用?PHP SimpleSAML_Utilities::checkCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSAML_Utilities的用法示例。


在下文中一共展示了SimpleSAML_Utilities::checkCookie方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: receiveAuthnRequest

 /**
  * Receive an authentication request.
  *
  * @param SimpleSAML_IdP $idp  The IdP we are receiving it for.
  */
 public static function receiveAuthnRequest(SimpleSAML_IdP $idp)
 {
     if (isset($_REQUEST['cookieTime'])) {
         $cookieTime = (int) $_REQUEST['cookieTime'];
         if ($cookieTime + 5 > time()) {
             /*
              * Less than five seconds has passed since we were
              * here the last time. Cookies are probably disabled.
              */
             SimpleSAML_Utilities::checkCookie(SimpleSAML_Utilities::selfURL());
         }
     }
     if (!isset($_REQUEST['providerId'])) {
         throw new SimpleSAML_Error_BadRequest('Missing providerId parameter.');
     }
     $spEntityId = (string) $_REQUEST['providerId'];
     if (!isset($_REQUEST['shire'])) {
         throw new SimpleSAML_Error_BadRequest('Missing shire parameter.');
     }
     $shire = (string) $_REQUEST['shire'];
     if (isset($_REQUEST['target'])) {
         $target = $_REQUEST['target'];
     } else {
         $target = NULL;
     }
     SimpleSAML_Logger::info('Shib1.3 - IdP.SSOService: Got incoming Shib authnRequest from ' . var_export($spEntityId, TRUE) . '.');
     $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
     $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'shib13-sp-remote');
     $found = FALSE;
     foreach ($spMetadata->getEndpoints('AssertionConsumerService') as $ep) {
         if ($ep['Binding'] !== 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post') {
             continue;
         }
         if ($ep['Location'] !== $shire) {
             continue;
         }
         $found = TRUE;
         break;
     }
     if (!$found) {
         throw new Exception('Invalid AssertionConsumerService for SP ' . var_export($spEntityId, TRUE) . ': ' . var_export($shire, TRUE));
     }
     SimpleSAML_Stats::log('saml:idp:AuthnRequest', array('spEntityID' => $spEntityId, 'protocol' => 'saml1'));
     $sessionLostURL = SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array('cookieTime' => time()));
     $state = array('Responder' => array('sspmod_saml_IdP_SAML1', 'sendResponse'), 'SPMetadata' => $spMetadata->toArray(), 'saml:shire' => $shire, 'saml:target' => $target, 'saml:AuthnRequestReceivedAt' => microtime(TRUE));
     $idp->handleAuthenticationRequest($state);
 }
开发者ID:shirlei,项目名称:simplesaml,代码行数:52,代码来源:SAML1.php

示例2: receiveAuthnRequest

 /**
  * Receive an authentication request.
  *
  * @param SimpleSAML_IdP $idp  The IdP we are receiving it for.
  */
 public static function receiveAuthnRequest(SimpleSAML_IdP $idp)
 {
     $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
     $idpMetadata = $idp->getConfig();
     $supportedBindings = array(SAML2_Const::BINDING_HTTP_POST);
     if ($idpMetadata->getBoolean('saml20.sendartifact', FALSE)) {
         $supportedBindings[] = SAML2_Const::BINDING_HTTP_ARTIFACT;
     }
     if ($idpMetadata->getBoolean('saml20.hok.assertion', FALSE)) {
         $supportedBindings[] = SAML2_Const::BINDING_HOK_SSO;
     }
     if (isset($_REQUEST['spentityid'])) {
         /* IdP initiated authentication. */
         if (isset($_REQUEST['cookieTime'])) {
             $cookieTime = (int) $_REQUEST['cookieTime'];
             if ($cookieTime + 5 > time()) {
                 /*
                  * Less than five seconds has passed since we were
                  * here the last time. Cookies are probably disabled.
                  */
                 SimpleSAML_Utilities::checkCookie(SimpleSAML_Utilities::selfURL());
             }
         }
         $spEntityId = (string) $_REQUEST['spentityid'];
         $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote');
         if (isset($_REQUEST['RelayState'])) {
             $relayState = (string) $_REQUEST['RelayState'];
         } else {
             $relayState = NULL;
         }
         if (isset($_REQUEST['binding'])) {
             $protocolBinding = (string) $_REQUEST['binding'];
         } else {
             $protocolBinding = NULL;
         }
         if (isset($_REQUEST['NameIDFormat'])) {
             $nameIDFormat = (string) $_REQUEST['NameIDFormat'];
         } else {
             $nameIDFormat = NULL;
         }
         $requestId = NULL;
         $IDPList = array();
         $ProxyCount = NULL;
         $RequesterID = NULL;
         $forceAuthn = FALSE;
         $isPassive = FALSE;
         $consumerURL = NULL;
         $consumerIndex = NULL;
         $extensions = NULL;
         $allowCreate = TRUE;
         $idpInit = TRUE;
         SimpleSAML_Logger::info('SAML2.0 - IdP.SSOService: IdP initiated authentication: ' . var_export($spEntityId, TRUE));
     } else {
         $binding = SAML2_Binding::getCurrentBinding();
         $request = $binding->receive();
         if (!$request instanceof SAML2_AuthnRequest) {
             throw new SimpleSAML_Error_BadRequest('Message received on authentication request endpoint wasn\'t an authentication request.');
         }
         $spEntityId = $request->getIssuer();
         if ($spEntityId === NULL) {
             throw new SimpleSAML_Error_BadRequest('Received message on authentication request endpoint without issuer.');
         }
         $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote');
         sspmod_saml_Message::validateMessage($spMetadata, $idpMetadata, $request);
         $relayState = $request->getRelayState();
         $requestId = $request->getId();
         $IDPList = $request->getIDPList();
         $ProxyCount = $request->getProxyCount();
         if ($ProxyCount !== null) {
             $ProxyCount--;
         }
         $RequesterID = $request->getRequesterID();
         $forceAuthn = $request->getForceAuthn();
         $isPassive = $request->getIsPassive();
         $consumerURL = $request->getAssertionConsumerServiceURL();
         $protocolBinding = $request->getProtocolBinding();
         $consumerIndex = $request->getAssertionConsumerServiceIndex();
         $extensions = $request->getExtensions();
         $nameIdPolicy = $request->getNameIdPolicy();
         if (isset($nameIdPolicy['Format'])) {
             $nameIDFormat = $nameIdPolicy['Format'];
         } else {
             $nameIDFormat = NULL;
         }
         if (isset($nameIdPolicy['AllowCreate'])) {
             $allowCreate = $nameIdPolicy['AllowCreate'];
         } else {
             $allowCreate = FALSE;
         }
         $idpInit = FALSE;
         SimpleSAML_Logger::info('SAML2.0 - IdP.SSOService: Incomming Authentication request: ' . var_export($spEntityId, TRUE));
     }
     SimpleSAML_Stats::log('saml:idp:AuthnRequest', array('spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'forceAuthn' => $forceAuthn, 'isPassive' => $isPassive, 'protocol' => 'saml2', 'idpInit' => $idpInit));
     $acsEndpoint = self::getAssertionConsumerService($supportedBindings, $spMetadata, $consumerURL, $protocolBinding, $consumerIndex);
     $IDPList = array_unique(array_merge($IDPList, $spMetadata->getArrayizeString('IDPList', array())));
//.........这里部分代码省略.........
开发者ID:ravi-sharma,项目名称:saml-sso-integration,代码行数:101,代码来源:SAML2.php

示例3: receiveAuthnRequest

 /**
  * Receive an authentication request.
  *
  * @param SimpleSAML_IdP $idp  The IdP we are receiving it for.
  */
 public static function receiveAuthnRequest(SimpleSAML_IdP $idp)
 {
     $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
     $idpMetadata = $idp->getConfig();
     $supportedBindings = array(SAML2_Const::BINDING_HTTP_POST);
     if ($idpMetadata->getBoolean('saml20.sendartifact', FALSE)) {
         $supportedBindings[] = SAML2_Const::BINDING_HTTP_ARTIFACT;
     }
     if (isset($_REQUEST['spentityid'])) {
         /* IdP initiated authentication. */
         if (isset($_REQUEST['cookieTime'])) {
             $cookieTime = (int) $_REQUEST['cookieTime'];
             if ($cookieTime + 5 > time()) {
                 /*
                  * Less than five seconds has passed since we were
                  * here the last time. Cookies are probably disabled.
                  */
                 SimpleSAML_Utilities::checkCookie(SimpleSAML_Utilities::selfURL());
             }
         }
         $spEntityId = (string) $_REQUEST['spentityid'];
         $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote');
         if (isset($_REQUEST['RelayState'])) {
             $relayState = (string) $_REQUEST['RelayState'];
         } else {
             $relayState = NULL;
         }
         if (isset($_REQUEST['binding'])) {
             $protocolBinding = (string) $_REQUEST['binding'];
         } else {
             $protocolBinding = NULL;
         }
         if (isset($_REQUEST['NameIDFormat'])) {
             $nameIDFormat = (string) $_REQUEST['NameIDFormat'];
         } else {
             $nameIDFormat = NULL;
         }
         $requestId = NULL;
         $IDPList = array();
         $ProxyCount = NULL;
         $RequesterID = NULL;
         $forceAuthn = FALSE;
         $isPassive = FALSE;
         $consumerURL = NULL;
         SimpleSAML_Logger::info('SAML2.0 - IdP.SSOService: IdP initiated authentication: ' . var_export($spEntityId, TRUE));
     } else {
         $binding = SAML2_Binding::getCurrentBinding();
         $request = $binding->receive();
         if (!$request instanceof SAML2_AuthnRequest) {
             throw new SimpleSAML_Error_BadRequest('Message received on authentication request endpoint wasn\'t an authentication request.');
         }
         $spEntityId = $request->getIssuer();
         if ($spEntityId === NULL) {
             throw new SimpleSAML_Error_BadRequest('Received message on authentication request endpoint without issuer.');
         }
         $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote');
         sspmod_saml_Message::validateMessage($spMetadata, $idpMetadata, $request);
         $relayState = $request->getRelayState();
         $requestId = $request->getId();
         $IDPList = $request->getIDPList();
         $ProxyCount = $request->getProxyCount();
         if ($ProxyCount !== null) {
             $ProxyCount--;
         }
         $RequesterID = $request->getRequesterID();
         $forceAuthn = $request->getForceAuthn();
         $isPassive = $request->getIsPassive();
         $consumerURL = $request->getAssertionConsumerServiceURL();
         $protocolBinding = $request->getProtocolBinding();
         $nameIdPolicy = $request->getNameIdPolicy();
         if (isset($nameIdPolicy['Format'])) {
             $nameIDFormat = $nameIdPolicy['Format'];
         } else {
             $nameIDFormat = NULL;
         }
         SimpleSAML_Logger::info('SAML2.0 - IdP.SSOService: Incomming Authentication request: ' . var_export($spEntityId, TRUE));
     }
     if ($protocolBinding === NULL || !in_array($protocolBinding, $supportedBindings, TRUE)) {
         /*
          * No binding specified or unsupported binding requested - default to HTTP-POST.
          * TODO: Select any supported binding based on default endpoint?
          */
         $protocolBinding = SAML2_Const::BINDING_HTTP_POST;
     }
     if ($consumerURL !== NULL) {
         $found = FALSE;
         foreach ($spMetadata->getEndpoints('AssertionConsumerService') as $ep) {
             if ($ep['Binding'] !== $protocolBinding) {
                 continue;
             }
             if ($ep['Location'] !== $consumerURL) {
                 continue;
             }
             $found = TRUE;
             break;
//.........这里部分代码省略.........
开发者ID:filonuse,项目名称:fedlab,代码行数:101,代码来源:SAML2.php


注:本文中的SimpleSAML_Utilities::checkCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。