【问题标题】:Need advice on authentication for android client connecting to the WCF Rest setup需要有关连接到 WCF Rest 设置的 android 客户端身份验证的建议
【发布时间】:2012-03-27 10:31:34
【问题描述】:

基本上我想通过身份验证从 android 连接到 WCF windows 服务。我是一名安卓开发者。我已经从 article 和 also configured the https 修改了 WCF Rest 服务。

现在我需要考虑从 android 到 WCF 服务的身份验证过程(到数据库中的用户名和密码)。我是否应该在 url 中编码用户名和密码并进行 http post,同时返回一个令牌进行授权,用于登录过程并使用令牌和用户名进行后续操作(并将加密的用户名和令牌保存在 pref 文件中以避免登录下一个时间,从而避免密码)?欢迎任何建议和对任何项目和文档的指导。

【问题讨论】:

    标签: android wcf authorization restful-authentication


    【解决方案1】:

    程序员https://softwareengineering.stackexchange.com/questions/93005/designing-authentication-for-rest-api 有一个类似的问题,但我想保持这个问题开放,因为我想在这里添加有用的代码和链接。

    而不是在 url 中编码用户名和密码,它们应该在请求正文中。原因是即使https encrypt the url,这也不是一个好的做法,因为如果从浏览器调用 url,浏览器会记住它,并且用户名/密码将在浏览器历史记录中可见。因此,这里有一篇处理http Post的文章http://www.codeproject.com/Tips/150313/Simple-WCF-web-service-to-receive-parameter-from-H

    如果使用自签名证书实现https,则需要做一些额外的工作 http://blog.antoine.li/2010/10/22/android-trusting-ssl-certificates/

    更多关于 WCF rest 和 android 的文章http://fszlin.dymetis.com/post/2010/05/10/Comsuming-WCF-Services-With-Android.aspx

    在 C# 中创建自定义令牌 http://msdn.microsoft.com/en-us/library/ms731872.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-13
      • 2010-10-19
      • 2023-04-06
      • 2011-04-09
      • 2013-10-07
      • 2016-01-31
      • 2014-08-24
      • 2012-01-03
      相关资源
      最近更新 更多