当标识符中没有用户名时,如何识别 OpenID 用户名?
我正在尝试在我的网站上实现 openID 并通读 Plaxo 和有关 SO 的问题。我目前可以使用这些库对我的用户进行身份验证。但我注意到一些提供商,例如
我正在尝试实现一个类似于Plaxo,我将在其中建立多对一关系的帐户。但是如何区分使用上述 openID url 的用户呢?我什至看到谷歌和谷歌个人资料是分开的。那么,在用户不提供用户名或者我应该说唯一的 openID 的情况下,他们如何识别用户?
I am trying to implement openID on my site and read through like Plaxo and questions on SO. I am currently able to authenticate my users using the libraries. But I notice that some providers like
- Google : https://www.google.com/accounts/o8/id
- Yahoo : https://me.yahoo.com
I am trying to implement a system similar to Plaxo, where I will have many-to-one relationship for account. But how do I distinguish users using openID urls like the above? I see even SO having google and google profile seperately. So, how do they identify the user in the case where user don't provide his username or I should say unique openID?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
OpenID 的设计初衷并不是为了在提供商处公开用户的“用户名”。您将获得一个经过验证的 URL,作为他们的身份,但该 URL 应被视为不透明字符串。
如果您需要这样做,那么您需要手动提示用户或使用属性交换(顺便说一句,这两种方式都不安全)。
OpenID isn't designed to expose the user's 'username' on the provider. You're provided with a verified URL that serves as their identity, but that URL should be treated as an opaque string.
If you need that, then you need to manually prompt the user or use attribute exchange (neither of which is secure, BTW).
当您收到 openid 回复时,将会有一个参数“openid.identity”,该参数对于每个帐户都是唯一的。它是一个非常长的半随机字符串,因此对于显示没有用:
您可以尝试根据“昵称”字段或电子邮件地址的本地部分生成一个漂亮的可显示用户名(如果提供了这些属性)。最后询问用户。
When you get the openid reply back, there will be a parameter "openid.identity" which is unique for each account. It is a very long semi random string, so it is not useful for displaying:
You can try to generate a nice displayable username bases on the "nickname" field or the local part of the email address, if those attributes are provided. And as last possibility ask the user.