简体   繁体   English

使用android中的restful web服务处理身份验证

[英]Handling Authentication using restful web service in android

I'm developing an android app where it will replicate my web application. 我正在开发一个Android应用程序,它将复制我的Web应用程序。 My web application has login/authentication/sessions, which is implemented using spring security frame work. 我的Web应用程序具有登录/身份验证/会话,这是使用Spring安全框架工作实现的。 Now the problem is I need to handle each and every job in android application to be done using RESTful web service securely but I'm unable to find the correct way of implementing the web service. 现在的问题是我需要安全地处理Android应用程序中的每一项工作,使用RESTful Web服务安全地完成,但我无法找到实现Web服务的正确方法。 I'm using this tutorial , which is actually not secure. 我正在使用本教程 ,实际上并不安全。 He has given some tips on how to do it securely using OAUTH but it isn't clear for me. 他已经提供了一些关于如何使用OAUTH安全地做到这一点的技巧,但对我来说并不清楚。

My questions are; 我的问题是;

  • Since, REST is state-less and android app is not a browser, we cannot do session management based on cookies but some say we can. 由于REST是无状态且Android应用程序不是浏览器,我们不能基于cookie进行会话管理,但有些人说我们可以。 if so how? 如果是这样的话?
  • I have heard about Spring Android library for handling sessions easily but did not find proper documentation. 我听说过Spring Android库可以轻松处理会话,但没有找到合适的文档。 If any one has links regarding it. 如果任何人有关于它的链接。 post them here. 把它们发在这里。
  • If possible provide me the links to the detailed explanation/tutorials for RESTful secured web services for spring security. 如果可能,请提供指向Spring安全性RESTful安全Web服务的详细说明/教程的链接。

Normally for mobile clients with RESTful Web Services, I have not used sessions. 通常对于具有RESTful Web服务的移动客户端,我没有使用会话。 Usually each method is authenticated independently, often by using https and passing the username password in as either parameters in the URL or using Basic Authentication. 通常,每种方法都是独立验证的,通常使用https并将用户名密码作为URL中的参数或使用基本身份验证传递。 See for example this quesiont and answers: 例如,参见这个问题和答案:

Calling Restful Web Service with Android 使用Android调用Restful Web服务

Maybe easiest solution for you in this case will be open webview and load you web app login. 在这种情况下,对您来说也许最简单的解决方案是打开webview并加载您的Web应用程序登录。 User will login and you will check response and maybe return some token. 用户将登录,您将检查响应并可能返回一些令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM