Tag: dotnetopenauth

OpenIdProvider.GetRequest()返回null

作为这个问题的延续,我遇到了dotnetopenauth的问题。 我导航到我的依赖方代码并创建请求,但是当我的提供者收到请求时, OpenIdProvider.GetRequest()返回null。 我查看了代码,据我所知,这是因为我的依赖方没有交付openid有效负载(request.form); 但我无法弄清楚为什么会这样。 码: 依赖方: public ActionResult Authenticate(string RuserName = “”) { UriBuilder returnToBuilder = new UriBuilder(Request.Url); returnToBuilder.Path = “/OpenId/Authenticate”; returnToBuilder.Query = null; returnToBuilder.Fragment = null; Uri returnTo = returnToBuilder.Uri; returnToBuilder.Path = “/”; Realm realm = returnToBuilder.Uri; var response = openid.GetResponse(); if (response == null) { if (Request.QueryString[“ReturnUrl”] != null && User.Identity.IsAuthenticated) { […]

OpenID领域是否必须是网站的基本URL?

作为这个问题的延续,我遇到了与dotnetopenauth有关的问题。 基本上,我想知道RP中指定的领域是否必须是应用程序的实际基本URL? 也就是说,( http://localhost:1903 )? 鉴于现有的体系结构,很难删除重定向 – 我尝试将域设置为基础OpenId控制器( http://localhost:1903/OpenId ),并且手动测试确实生成了XRDS文档。 但是,应用程序似乎冻结,EP日志显示以下错误: 2012-10-10 15:17:46,000 (GMT-4) [24] ERROR DotNetOpenAuth.OpenId – Attribute Exchange extension did not provide any aliases in the if_available or required lists. 码: 依赖方: public ActionResult Authenticate(string RuserName = “”) { UriBuilder returnToBuilder = new UriBuilder(Request.Url); returnToBuilder.Path = “/OpenId/Authenticate”; returnToBuilder.Query = null; returnToBuilder.Fragment = null; […]

从Google OpenID迁移到新的OAuth 2

我看到有一些问题已经存在,但我找不到任何细节。 我之前使用过自己的DotNetOpenAuth代码,但现在我决定切换到Microsoft Wrapper for Authentication。 无论如何,我发现这个非常好的OAuth客户端: https://github.com/mj1856/DotNetOpenAuth.GoogleOAuth2 它似乎工作正常,但现在它来到迁移部分。 在我当前的登录系统中,我保存了Google返回的完整OpenIDurl,其格式为: https://www.google.com/accounts/o8/id?id= ???????????????????????????? ???? 根据此处的文档https://developers.google.com/accounts/docs/OpenID我应该能够通过新的OAuth系统以某种方式获得该值。 我在Auth请求中包含了“openid.realm”参数。 return BuildUri(AuthorizationEndpoint, new NameValueCollection { { “response_type”, “code” }, { “client_id”, _clientId }, { “scope”, string.Join(” “, scopes) }, { “redirect_uri”, returnUrl.GetLeftPart(UriPartial.Path) }, { “state”, state }, { “openid.realm”, “http://myoldopenidrealm” } }); 据我所知,文档应该是我需要做的全部。 我确保我用于OpenID 2身份validation的Realm是相同的,它也与我的返回URL相同。 在我完成之后,我做了令牌请求,据我所知,我应该看到一个“open_id”字段,但我无法理解如何获取它。 protected override string QueryAccessToken(Uri returnUrl, […]

Html.OpenIdSelectorScripts抛出NullReferenceException的helper方法

尝试导航到LogOn页面时,我不断收到此错误: System.NullReferenceException:未将对象引用设置为对象的实例 抛出错误的代码行是: . 有谁知道为什么这行代码会抛出错误?

如何在客户端获取DotNetOpenAuth.OAuth2返回的错误消息?

我正在使用ExchangeUserCredentialForToken函数从授权服务器获取令牌。 当我的用户存在于我的数据库中时,它工作正常,但是当凭据是incorect时,我想向客户端发回消息。 我正在使用以下2行代码来设置错误消息: context.SetError(“Autorization Error”, “The username or password is incorrect!”); context.Rejected(); 但在客户端,我只得到协议错误(错误400)。 您能帮我解决一下如何在授权服务器上获取服务器端设置的错误消息? 来自授权服务器的完整应用程序配置: using Constants; using Microsoft.Owin; using Microsoft.Owin.Security; using Microsoft.Owin.Security.Cookies; using Microsoft.Owin.Security.Infrastructure; using Microsoft.Owin.Security.OAuth; using Owin; using System; using System.Collections.Concurrent; using System.Linq; using System.Security.Claims; using System.Security.Principal; using System.Threading.Tasks; using AuthorizationServer.Entities; using AuthorizationServer.Entities.Infrastructure.Abstract; using AuthorizationServer.Entities.Infrastructure.Concrete; namespace AuthorizationServer { public partial class Startup { […]

DotNetOpenAuth的教程在哪里以及如何解决其样本中的编译错误

我知道stackoverflow使用OpenID身份validation。 我也想尝试使用它。 我正在使用带有C#的asp.net mvc 2.0。 我找到了这个 http://www.dotnetopenauth.net/ 我想知道这是否是用于stackoverflow的。 任何教程也都很好。 编辑 我正在尝试加载一些示例项目,但是当我在VS2010中构建它时,我得到了 Error 6 ‘System.Diagnostics.Contracts.ContractInvariantMethodAttribute’ is inaccessible due to its protection level C:\Users\chobo2\Downloads\DotNetOpenAuth-3.4.6.10357\DotNetOpenAuth-3.4.6.10357\Samples\OpenIdOfflineProvider\TextBoxTextWriter.cs 73 4 OpenIdOfflineProvider Error 7 The type or namespace name ‘ContractInvariantMethod’ could not be found (are you missing a using directive or an assembly reference?) C:\Users\chobo2\Downloads\DotNetOpenAuth-3.4.6.10357\DotNetOpenAuth-3.4.6.10357\Samples\OpenIdOfflineProvider\TextBoxTextWriter.cs 73 4 OpenIdOfflineProvider

使用Windows身份validation时,MVC5重定向到Login.aspx

从MVC 4升级到MVC 5后,我的应用程序(从Visual Studio中启动时)会出现以下错误。 值得注意的是,我在同一个项目中托管MVC5和WebAPI2项目,因为可能存在干扰。 我还安装了dotnetopenauth nuget包(我已删除): Server Error in ‘/’ Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled […]

如何使用OAuth连接到Etrade API?

E-Trade最近发布了他们的API,并提供了一些有用但不完整的技术文档 。 有没有人在C#中有一个完整的工作示例,说明这是如何工作的? 我已经能够正确地使用OAuth进行身份validation,但是当从我的帐户或市场数据中获取信息时,服务器会失败。

我应该为ASP .NET MVC应用程序使用内置成员资格提供程序吗?

到目前为止,我一直在使用自定义成员资格提供程序进行身份validation。 我即将开始使用MVC开发我的第一个网站。 我想知道我是否应该使用ASP .NET MVC附带的内置成员资格提供程序,或者我是否应该创建自己的。 我的网站需要与openid,facebook,google等集成进行身份validation和api访问的openauth。 我想知道根据我的需要使用内置的那么容易。

AuthenticationResult.IsSuccessful开始为谷歌返回false

今天,在我的实际网站上没有任何更改,使用Google外部登录提供程序登录停止了工作。 这只发生在有谷歌登录的用户,其他提供商都没问题。 这也只发生在实时网站上,我的dev机器运行相同代码的调试版本就可以了。 我的代码类似于示例MVC应用程序: public ActionResult ExternalLoginCallback( string returnUrl ) { … AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication( Url.Action( “ExternalLoginCallback”, new { ReturnUrl = returnUrl } ) ); if( !result.IsSuccessful ) { return RedirectToAction( “ExternalLoginFailure” ); } } 我看了一下空的result.error。 有什么变化我需要注意吗? 我可以在1月4日看到类似的问题。 我想这与我的实现有关,而不是谷歌范围的问题,因为我仍然可以登录使用我的谷歌开放ID的SO。 我正在使用Log4Net并接收DotNetOpenAuth日志,但是没有错误,所以它与此答案不同。 我尝试从4.3.0.13117升级到最新的Nuget(4.3.4.13329),但这没有效果。 我似乎也无法在存储库中找到4.3.4.13329源代码的标记。 我将尝试下载并构建4.3.0.13117以查看是否可以找到原因。 唯一的问题是,这可以在我的本地计算机上进行良好的测试,我不确定我是否想在现场网站上安装调试DLL。