top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Authentication from a REST service

0 votes
327 views

I am in the process of setting up a web service between an android app and Tomcat 6.0.26 implemented with Jersey. I already have client and server communicating with each other by sending XML requests. But I would like the user of the client to be authenticated by the server for a set period of time and then have to re-authenticate after that time has expired.

Please suggest?

posted Jul 18, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If you are using Servlet 3.0, you can use HttpServletRequest.login to authenticate the user using a realm configured for the context. If you use FORM authentication, then the session's expiration time becomes the duration of the login (a caveat being that the timeout is reset for every request the client makes).

If you want fixed-login times (like 30-minutes max regardless of how many requests are made), then stuff your own expiration date into the user's session and then check that timeout with each request. This could all be done in a Filter to keep things orthogonal to your servlet code.

answer Jul 18, 2013 by anonymous
Similar Questions
0 votes

I have editors which will use syntax highlighting on .rst files, but I'm hoping for something a bit smarter.

What I'd like is an editor with a split window, one side showing the rst that I can edit, the other side showing the formatted text updated as I type. (Or at least, updated every thirty seconds or so.)

Anybody know anything like that?

+2 votes

I am trying to put one search engine interface in REST. To do this I am trying to learn Restframework and Django. One question occurred to me is, whether there is any Restframework editor which may do this job.

Is there any?

I was trying to find out https://pypi.python.org/pypi/restview , is it doing this? In that case, if any one may kindly share some examples or tutorial for it.

...