开发者

Easy OpenID Implementation

开发者 https://www.devze.com 2023-01-25 04:28 出处:网络
I\'ve looked around for OpenID tutorials and I can\'t seem to find anything that\'s just really simple and straightforward on how to skip a registra开发者_开发问答tion process and get the user\'s emai

I've looked around for OpenID tutorials and I can't seem to find anything that's just really simple and straightforward on how to skip a registra开发者_开发问答tion process and get the user's email address and stuff like that for PHP (or any language for that matter). Is it just too new or does it just lack content? Perhaps you know of a link that I don't?


I'm not sure what you mean by "how to skip the registration process". The registration process is defined in your application, not as part of OpenID.

OpenID is a basis for delegated authentication: it allows for each user to provide a unique identifier (the Identity URL) and allows for you to verify that the user really does own the identifier. There are extensions, most notably SReg (simple registration) and AX (attribute exchange) to allow for querying additional information. Keep in mind that not all identity providers support them.

If I may sum up OpenID in 4 simple steps:

  1. Query the user for their OpenID URL. Some providers, such as Google, allow you to use a generic URL and they figure out automatically what the user's complete identity URL is.
  2. Forward the user to the provider for them to confirm, typically via a username/password combination, that they own the URL.
  3. The identity provider will use the "return URL" you specified in step (2) and redirect the user to it along with the response.
  4. Parse said response for success/failure status.

If the provider supports SReg or AX, you must register them in the request during (2) and parse the returned attributes in step (4).

Edit: if you were to register the user, it would be done after step (4). The setup I have uses the returned attributes, if any, to pre-populate the registration form. As I said, this registration form may be omitted and you can generate a username automatically.


Their wiki is pretty decent. This page contains implementations for many languages. Perhaps this will help.

http://wiki.openid.net/w/page/12995176/Libraries

0

精彩评论

暂无评论...
验证码 换一张
取 消