【问题标题】:Implement single logout in simplesamlphp在 simplesamlphp 中实现单点注销
【发布时间】:2015-08-29 05:37:36
【问题描述】:

这是我上一个问题的延续

Central login with SAML and making site to work as identity provider

现在我在 cauth.com 和 a.com(或 b.com)都有会话。单击“注销”按钮在这两个站点上注销会话的最佳方法是什么?

这是我在 cauth.com

中编写的注销代码
   public function actionSlo(){
      $metadata = \SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
      $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
     $idp = \SimpleSAML_IdP::getById('saml2:' . $idpEntityId);
      \sspmod_saml_IdP_SAML2::receiveLogoutMessage($idp);
      assert('FALSE');

      //destroy session 
      session_destroy();

      //redirect to the spentity
      $spId = $_GET['spentityid'];
      header("location:".$spId);

   }

在我看来,注销需要 3 个 http 重定向

1 .当用户点击“注销”时,请求的页面是 cauth.com/slo。

  1. 然后从这个用户将被带到主站点(a.com 或 b.com)的注销。

  2. 用户将被重定向到主站点的索引页面。

我想知道有什么方法可以在内部处理 saml 注销以减少 http 重定向的数量,同时记住我必须清除两个站点上的会话变量?

【问题讨论】:

  • 嗨@alwaysLearn,你解决了这个问题吗?我遇到了同样的问题,如果您解决了问题,请用您的答案进行编辑。谢谢。

标签: php session simplesamlphp


【解决方案1】:

尝试清除用户会话

cauth.com( (cauth.com/logout))

清除用户会话需要在之前启动您的用户会话并销毁当前用户会话

session_start();    
session_unset();
session_destroy();

【讨论】:

  • 对不起,这并没有回答我的问题。我当然知道如何销毁会话。请再次阅读我的问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-05-12
  • 2018-12-04
  • 2023-03-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-19
相关资源
最近更新 更多