如何使用OpenID的,而不要求用户输入自己的OpenID网址? [英] How to use OpenID without asking user for his OpenID URL?

查看:194
本文介绍了如何使用OpenID的,而不要求用户输入自己的OpenID网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了​​使用DotNetOpenAuth一个OpenID提供商,我坚持。

I'm setting up an OpenID provider using DotNetOpenAuth and I'm stuck.

似乎的OpenID,要求操作者首先提供他的OpenID URL,然后消费者将他重定向到提供者,给URL作为参数(checkid_setup模式)。

It seems that OpenID requires that the user provides his OpenID URL first, and then the consumer would redirect him to the provider, giving the URL as a parameter (checkid_setup mode).

但随着谷歌和其他一些供应商,它的工作方式不同。你只是重定向到一个通用的页面,你要么登录,或选择你已经登录的帐户之一。或者只是重定向回来,如果你登录的一个帐户。

But with google, and some other providers, it works differently. You are just redirected to a generic page where you would either sign in, or select one of the accounts you're already logged in with. Or just redirected back if you're logged in with a single account.

时此主题相关的checkid_immediate模式?如果是的话,请给我一个链接到一篇文章,解释如何工作的。

Is this somehow related to the checkid_immediate mode? If so, please give me a link to an article explaining how that works.

推荐答案

在你所看到的行为不同的是正交于checkid_setup对,你注意到checkid_immediate模式。

The difference in behavior you're seeing is orthogonal to the checkid_setup vs. checkid_immediate modes that you're noticing.

如果在自己的OpenID用户类型,这就是所谓的一个的声明的标识符的。相反,如果用户只要点击(或类型)他的供应商(如谷歌在你的例子),这就是所谓的 OP标识符的。

If the user types in his own OpenID, that's called a Claimed Identifier. If instead the user just clicks (or types) his provider (e.g. Google in your example), that's called an OP Identifier.

例如,如果你在 https://www.google.com/accounts/o8/id 键入到OpenID的框,你会看到的行为,你再描述性的,谷歌将帮助用户登录到你的网站,谁就该用户。

For instance, if you type in https://www.google.com/accounts/o8/id into the OpenID box, you'll see the behavior you're describing, in that Google will assist the user in logging into your web site, whoever that user is.

所以在这一点上,你有几种选择:

So at this point you have a few options:

  1. 如果您的网站是基于ASP.NET Web表单,您可以使用 OpenIdButton 控件,输入在的https:/然后/www.google.com/accounts/o8/id 识别到相应的属性,用户可以点击该按钮,只需登录使用他们的谷歌帐户。

  1. If your site is based on ASP.NET web forms, you can use the OpenIdButton control, typing in the https://www.google.com/accounts/o8/id identifier into the appropriate property, and the user can then click that button to simply log in using their Google account.

如果你使用MVC(或使用Web表单,但要以编程方式做到这一点),你可以调用 OpenIdRelyingParty.CreateRequest(https://www.google.com/accounts/ O8 / ID)和重定向,结果给谷歌用户。

If you're using MVC (or using web forms but want to do this programmatically) you can call OpenIdRelyingParty.CreateRequest("https://www.google.com/accounts/o8/id") and redirect the user with the result to Google.

无论哪种方式,如果已经登录到谷歌的用户,他们不会需要登录到谷歌。如果用户已经告知谷歌,他们批准登录到您的网站,那么他们将不会看到谷歌在所有在此登录过程。

Either way, if the user is already logged into Google, they won't need to log into Google. And if the user has already told Google that they approve logging into your web site, then they won't see Google at all during this login process.

这篇关于如何使用OpenID的,而不要求用户输入自己的OpenID网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆