首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >browserID服务器注销

browserID服务器注销
EN

Stack Overflow用户
提问于 2011-09-20 12:26:12
回答 2查看 371关注 0票数 0

因此,我找到了这个browserid.org,然后找到了这个browserid.org/developers,并决定尝试一下这种新的身份验证方法,即browserID。在深入研究我能找到的唯一半官方示例( browserid_favbeer_example )并来回翻转到3个简单的步骤页面后,我仍然感到困惑。我搜索了一下,找到了一个,javascript实现可以很容易地利用(目前)和第二个,从一个非常好的家伙,下面的例子。我注意到它遗漏的第一件事是注销。如果有人能帮我完成注销,我将不胜感激。

代码语言:javascript
运行
复制
<?php
/*
 * Simple implementation of Mozilla BrowserID (see https://browserid.org/)
 * Author : Guillaume <guillaume@atto.be>
 */
/*
 * Usage :
 *
$browserid = new BrowserID('mywebserver.com', $_POST['assertion']);
if($browserid->verify_assertion())
{
      echo('Welcome, your email is '.$browserid->get_email());
}
 */
class BrowserID
{
  private $audience;
  private $assertion;
  private $email;
  private $validity;
  private $issuer;
  private function post_request($url, $data)
  {
    $params = array('http' => array('method' => 'POST', 'content' => $data));
      return stream_get_contents($fp);
    }
    else
    {
      return FALSE;
        }
      }
      public function BrowserID($audience, $assertion)
      {
        $this->audience = $audience;
        $this->assertion = $assertion;
      }
      /*
       * Send the assertion to the browserid.org server (this must be over HTTPS)
       * The response is read to determine is the assertion is authentic
       */
      public function verify_assertion()
      {
                if(isset($result['status']) && $result['status'] == 'okay')
        {
          $this->email = $result['email'];
          $this->validity = $result['valid-until'];
          $this->issuer = $result['issuer'];
          return true;
        }
        else
        {
          return false;
        }
      }
      public function get_email()
      {
    return $this->email;
  }
  public function get_validity()
    return $this->email;
  }
  public function get_validity()
 * Usage :
 *
$browserid = new BrowserID('mywebserver.com', $_POST['assertion']);
if($browserid->verify_assertion())
{
  echo('Welcome, your email is '.$browserid->get_email());
}
 */
class BrowserID
{
  private $audience;
  private $assertion;
  private $email;
  private $validity;
  private $issuer;
  private function post_request($url, $data)
  {
    $params = array('http' => array('method' => 'POST', 'content' => $data));
      return stream_get_contents($fp);
    }
    else
    {
      return FALSE;
    }
  }
  public function BrowserID($audience, $assertion)
  {
    $this->audience = $audience;
    $this->assertion = $assertion;
  }
  /*
   * Send the assertion to the browserid.org server (this must be over HTTPS)
   * The response is read to determine is the assertion is authentic
   */
  public function verify_assertion()
  {
    if(isset($result['status']) && $result['status'] == 'okay')
    {
      $this->email = $result['email'];
      $this->validity = $result['valid-until'];
      $this->issuer = $result['issuer'];
      return true;
    }
    else
    {
      return false;
    }
  }
  public function get_email()
  {
    return $this->email;
  }
  public function get_validity()
  {
    return $this->validity;
  }
  public function get_issuer()
  {
    return $this->issuer;
  }
}// end class BrowserID
$browserid = new BrowserID($_SERVER['HTTP_HOST'], $_POST['assertion']);
if($browserid->verify_assertion())
{
  echo('Welcome '.$browserid->get_email());
}
else
{
  echo('Identification failure');
}
?>
EN

Stack Overflow用户

发布于 2011-11-26 07:10:36

我希望现在回答你的问题还不算太晚。这是BrowserID邮件列表中的noticed,但不幸的是没有人回来回答您。

在使用BrowserID进行身份验证后,您可以设置一个身份验证cookie,并根据该cookie确定用户是否有效。然后,要注销,您需要为用户提供一个链接,该链接将使您删除该cookie。

票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7480137

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档