我试图在客户端上使用OAuth(facebook/twitter)然后使用ServiceStack进行身份验证时感到困惑.我看到在客户端进行身份验证的所有示例都使用基本身份验证,如下所示:
var response = _client.Send<AuthResponse>(new Auth
{
provider = CredentialsAuthProvider.Name,
UserName = model.Username,
Password = model.Password,
RememberMe = true
});
Run Code Online (Sandbox Code Playgroud)
我需要做些什么才能通过Facebook验证我的独立客户端?我打电话给FB并获得UID,访问令牌,电子邮件等,那么对服务堆栈的调用是什么?
目前我的想法是在客户端上使用FB进行身份验证,调用服务以检查用户是否存在(查看电子邮件地址).如果他们没有注册并使用他们的一些数据的哈希作为密码登录.如果它们存在,请以相同方式记录它们.这是合理/最佳做法吗?
提前致谢
我有一个应用程序,它使用带有netTcpBinding的WCF上传大文件.对于特定文件,我收到错误消息:
已超出传入邮件的最大邮件大小限额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.
这是我对客户端web.config文件的绑定(客户端是一个ASP.NET网站):
<binding name="DataImportEndpoint" closeTimeout="00:20:00" openTimeout="00:01:00"
receiveTimeout="00:20:00" sendTimeout="00:20:00" transferMode="Buffered"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="5242880" maxReceivedMessageSize="5242880">
<readerQuotas maxDepth="32" maxStringContentLength="524288" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
</security>
</binding>
Run Code Online (Sandbox Code Playgroud)
我意识到我还需要更改服务配置的maxReceivedMessageSize属性.所以我添加了这个绑定:
<bindings>
<netTcpBinding>
<binding name="NetTcpLarge"
maxReceivedMessageSize="5242880" maxBufferSize="5242880">
<readerQuotas maxStringContentLength="524288"/>
</binding>
</netTcpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
并修改了我的端点:
<endpoint address="DataImportService" binding="netTcpBinding"
name="DataImportEndpoint" bindingConfiguration="NetTcpLarge"
contract="IDataImportService" />
Run Code Online (Sandbox Code Playgroud)
这解决了我在Visual Studio中运行自托管时的问题.但是在IIS 7上运行的实例上,我仍然遇到超出65536的错误.我错过了什么吗?我甚至将它添加到IIS 7实例中的服务配置中,但无济于事:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="5242880" />
</requestFiltering>
</security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)