我的任务是保护使用 WCF 的 Web 服务,并为 Silverlight、WP7 和 Android 设备提供 Web 服务。
所以我认为我应该激活 SSL 并向 Web 服务添加一种身份验证/授权形式。
现在我知道我可以在 web.config 和 IIS 中打开 Windows 身份验证,它将自动使用 PC 的登录信息进行身份验证。但我不知道当我使用 Intranet 之外的设备(特别是 Android 设备)时,这是否是正确的解决方案。我不想让我们团队中的 Android 开发人员使用这种身份验证方法,从而无法取得进展。那么这在 Android 中足够容易做到吗?
当我添加安全性时,我发现使用 添加到 basicHttpBinding
很容易,但这在 中不起作用代码>自定义绑定。与那些有什么不同吗?
I have been tasked with securing a web service that uses WCF and offers web services for both Silverlight, WP7 and Android devices.
So I believe I should activate SSL and also add a form of authentication/authorization to the web service.
Now I am aware that I can turn on Windows Authentication on my web.config and in IIS that will automagically use the log in for the PC for the authentication. But I don't know if this is the right solution to use when I am using devices outside of the intranet and specifically Android devices. I don't want to set up to use this method of Authentication for the Android developers on our team to not be able to progress. So is this easy enough to do in Android?
When I do add the security, I found it was easy to add to a basicHttpBinding
with <transport clientCredentialType="Windows"
but that this doesn't work within a customBinding
. Is there something different with those?
发布评论
评论(1)
我正在用我的应用程序做一些非常相似的事情。对于 Android 端,我们向设备发送一个 MobileUserId - 在我们的例子中,是一个
Guid
,它唯一标识用户。这仅为会话保存。从那里开始,对服务的每次调用也要求此Guid
有效。为了安全起见,您的 web.config 应该包含以下内容:
即使您选择不使用 Java 中的 Guid 或 UUID 等内容,您仍然需要某种方式从 Android 设备传递用户名/密码组合 - 它不适用于 Windows 身份验证。
您或许还应该研究一下
REST
或SOAP
。我发现 REST 更容易使用,所以我更喜欢它。I am doing something extremely similar with my applications. For the android side, we send the device a MobileUserId - in our case, a
Guid
, which uniquely identifies the user. This is saved only for the session. From there, each call to the service also requires thisGuid
to be valid.For the security, your
web.config
should have these:Even if you choose not to use something like a
Guid
, orUUID
in java, you will still need some way to pass a username / password combination from the android device - it will not work with windows authentication.You should also probably look into
REST
orSOAP
. I have foundREST
to be much easier to use, so I have preference towards it.