如何使用 Janrain openid 库获取标准化 url?

发布于 2024-10-09 19:04:07 字数 254 浏览 5 评论 0原文

我正在尝试为我的网站实现 openId,并使用 Janrain 的 php 库。我想检查用户提供的 openId 是否已存储在数据库中。我只想比较规范化的 uri,以避免用户有时不输入“http://...”等的情况。 现在,我很难找到可以在用户输入 openId 后立即为我标准化 uri 的特定函数,因此一旦它到达我的服务器,在任何内容发送到 openId 提供程序之前。 顺便说一句,正如你慢慢想象的那样,我厌倦了尝试让所有这些工作正常进行,但仍然愿意尝试一下,所以任何帮助将不胜感激。

I'm trying to implement openId for my site and am using Janrain's library with php. I want to check if openId user provided is already stored in database. I want to compare only normalized uri's to avoid situation when user sometimes doesn't type in "http://..." etc.
Now, I'm having trouble finding out specific function that can normalize uri for me right after user enters openId, so as soon as it hits my server, before anything is being send to openId provider.
btw as you can imagine slowly I am getting fed up with trying to get all this working, but still willing to give it a try so any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

楠木可依 2024-10-16 19:04:07

(假设您指的是 Janrain 的“OpenID Enabled”PHP5 库,v 2.2.2 或更高版本。)OpenID.php 中定义了 Auth_OpenID::normalizeUrl($url),但它被标记为 @访问私有。启动授权事务后,您将获得一个规范化的 URL,但这并不是您真正想要的。您可以忽略私有访问,破解库以将其公开,然后在升级版本时保留补丁(如果他们发布过版本)。或者,您可以只查看他们正在做什么并将其复制到您自己的函数中,避免任何库黑客和相关的版本控制问题。

(Assuming you mean Janrain's "OpenID Enabled" PHP5 library, v 2.2.2 or thereabouts.) There is Auth_OpenID::normalizeUrl($url) defined in OpenID.php, however it is marked as @access private. Initiating an authorization transaction will get you a normalized URL as a result of the process, but that's not really what you are looking for. You could ignore the private access, hack the library to make it public, and then just keep your patch implemented as you upgrade versions (if they ever release one). Alternatively, you could just look at what they're doing and copy it out to a function of your own, avoiding any library hacks and the associated version control issues.

凶凌 2024-10-16 19:04:07

如果您使用类似以下内容:

$url = str_replace(array("http://", "https://", "www."), "", $url);

那应该可以帮助您每次都获得相同的 URL。

If you use something like:

$url = str_replace(array("http://", "https://", "www."), "", $url);

That should help you get the same URL each time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文