users@jersey.java.net

Re: How to realize a simple user management?

From: Rahul Babbar <rahul.babbar1_at_gmail.com>
Date: Fri, 26 Nov 2010 09:35:00 -0800

You could try something like this.
Have a URL to the login page and the URL mapping for the REST resources in
web.xml.
Have some sort of an AuthenticationFilter over all the REST resources, which
intercepts the request and forwards or sends back the request.
Do not have the filter on the login page. If the user logs in and the login
is successful, set the cookie in the response as the Header.
Also, in AuthenticationFilter above, check to see if the user provided
cookie in the request header, if yes check for other conditions(like whether
it is still valid etc depending on the life of the cookie which is defined
when you create the cookie after user's login).

Rahul


On Thu, Nov 25, 2010 at 9:42 AM, tmp <le_tmp_at_gmx.de> wrote:

>
> Hello!
>
> I want to implement a simple webapp (it is a maven project that can be run
> via "mvn tomcat:run") where users can register and login (there is a db
> running and accessible with jdbc). After the user logged in, a cookie is
> set.
>
> The application also provides some rest resources which are only
> accessible,
> if the request contains this cookie.
>
> Can anyone give me some hints how to realize that? I could not find a good
> tutorial for that.
> Thanks in advance!
> --
> View this message in context:
> http://jersey.576304.n2.nabble.com/How-to-realize-a-simple-user-management-tp5775069p5775069.html
> Sent from the Jersey mailing list archive at Nabble.com.
>