ServiceStack OpenId AuthProviders on Mono

▼魔方 西西 提交于 2019-12-11 03:00:45

问题


The problem is that OpenId Auth providers aren't working under Ubuntu 12.04 with nginx/1.1.19, Mono JIT compiler version 3.1.1, fastcgi-mono-server4.exe 2.10.0.0

The ServiceStack references were all pulled via Nuget are at version 3.9.55.0, including ServiceStack.Authentication.OpenId which is attached to DotNetOpenAuth 4.3.0.0

The project is based on the ServiceStack Template CustomPath40 and all of the projects are built under .NET 4 with VS2012 on Win7x64.

Every auth works perfectly fine under IIS8/IIS8 Express. I configured the authproviders in AppHost, emulating the SocialBootstrapApi. Twitter and Facebook auth works just fine on mono, once running:

 mozroots --import --ask-remove

that trusts typical mozilla certs.

The OpenId providers will complain about lacking a log4net dll (again, only on mono), but supplying an appropriate log4net dll quiets that error. Now the OpenId providers (Google and Yahoo) both throw an exception:

 Method not found: 'System.Security.Cryptography.HashAlgorithm.Dispose'.

[Auth: 07/26/2013 04:21:13]:
[REQUEST: {provider:GoogleOpenId}] System.MissingMethodException: Method not found: 'System.Security.Cryptography.HashAlgorithm.Dispose'. at
DotNetOpenAuth.OpenId.HmacShaAssociation/HmacSha.CreateHasher (byte[]) <0x00017> at
DotNetOpenAuth.OpenId.HmacShaAssociation.CreateHasher () <0x0001b> at
DotNetOpenAuth.OpenId.Association.Sign (byte[]) <0x00034> at
DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement.GetSignature (DotNetOpenAuth.OpenId.ChannelElements.ITamperResistantOpenIdMessage,DotNetOpenAuth.OpenId.Association) <0x001f3> at
DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement.ProcessIncomingMessage (DotNetOpenAuth.Messaging.IProtocolMessage) <0x00133> at
DotNetOpenAuth.Messaging.Channel.ProcessIncomingMessage (DotNetOpenAuth.Messaging.IProtocolMessage) <0x001b1> at
DotNetOpenAuth.OpenId.ChannelElements.OpenIdChannel.ProcessIncomingMessage (DotNetOpenAuth.Messaging.IProtocolMessage) <0x000f3> at
DotNetOpenAuth.Messaging.Channel.ReadFromRequest (System.Web.HttpRequestBase) <0x00359> at
DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse (System.Web.HttpRequestBase) <0x00053> at
DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse () <0x0006f> at
ServiceStack.Authentication.OpenId.OpenIdOAuthProvider.Authenticate (ServiceStack.ServiceInterface.IServiceBase,ServiceStack.ServiceInterface.Auth.IAuthSession,ServiceStack.ServiceInterface.Auth.Auth) <0x00693> at
ServiceStack.ServiceInterface.Auth.AuthService.Authenticate (ServiceStack.ServiceInterface.Auth.Auth,string,ServiceStack.ServiceInterface.Auth.IAuthSession,ServiceStack.ServiceInterface.Auth.IAuthProvider) <0x0004f> at
ServiceStack.ServiceInterface.Auth.AuthService.Post (ServiceStack.ServiceInterface.Auth.Auth) <0x00247> at
ServiceStack.ServiceInterface.Auth.AuthService.Get (ServiceStack.ServiceInterface.Auth.Auth) <0x00013> at
(wrapper dynamic-method) object.lambda_method (System.Runtime.CompilerServices.Closure,object,object) <0x0004f> at
ServiceStack.ServiceHost.ServiceRunner`1<ServiceStack.ServiceInterface.Auth.Auth>.Execute (ServiceStack.ServiceHost.IRequestContext,object,ServiceStack.ServiceInterface.Auth.Auth) <0x001de>

The obvious problem would be the one detailed here: https://bugzilla.xamarin.com/show_bug.cgi?id=3375, but this is marked as resolved over a year ago in 2.10.x, while I built this 3.1.1 from tagged source last week.

How can I remedy this exception and get the OpenId Auth providers working on Mono?


回答1:


You claim to have installed Mono 3.1.1, but you didn't install xsp with the scripts that you used to install this new version of Mono.

This means then, that when you installed xsp from packages, you pulled in Mono 2.x as a dependency of it. So you thought you had uninstalled mono from packages, and installed a new Mono, but you were actually having 2 versions of Mono at the same time.

When running xsp from packages, you where running the binary located at /usr, which means it was using the old mono (not the new one that you installed in /usr/local).

Even if you're running mono-fastcgi-server4 instead of the xsp server, both servers codebase is common: the xsp repo, which you need to install alongside Mono: http://github.com/xsp



来源:https://stackoverflow.com/questions/17874626/servicestack-openid-authproviders-on-mono

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!