Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Pattern »

Re: Custom authentication strategy

Satyan Prakash

2004-02-17


Message
Or you can use a Servlet Filter in J2EE 1.3 the url pattern for which will be *. In fact you can consolidate all your security checks in this servlet and deploy it as a filter for all web resources.
----- Original Message -----
From: Aaron Tubman
Sent: Monday, February 16, 2004 9:05 AM
Subject: Re: Custom authentication strategy

I suggest using the Dispatcher (see chapter 6) pattern that is initial access point for each request in conjunction with Controller pattern

Something likes this:

 

Public class Dispathcher extends HttpServlet {

            Private AuthenticationController  authenticationController.

            public void doGet(HttpServletRequest request, HttpServletResponse response) {

                        if (!authenticationController.authenticate(request)) {

                                    response.sendRedirect("login");

                                    return;

}

 

// 'authenticate' method will analyze the validity of this "AuthenticationInfo" cookie.

response.addCookie(new Cookie("AuthenticationInfo", <some encripted info>));

 

            }

 

alternatively you can save AuthenticationInfo in your session. In this case Dispatcher require login upon each new user session while cookie can be saved

accros a time (days/months).

 

-----Original Message-----
From: An interest list for Sun Java Center J2EE Pattern Catalog [mailto:J2EEPATTERNS-INTEREST@JAVA.SUN.COM] On Behalf Of Katz Guy
Sent:
Monday, February 16, 2004 10:40 AM
To: J2EEPATTERNS-INTEREST@JAVA.SUN.COM
Subject: Custom authentication strategy

 

 

Hi all;
I have a requirement for being able to log in from any page.
I still want my solution to benefit from the container security services.
However, the container will prompt the login page only for protected resource and many of my resource are not protected but I would still like to be able to login from those pages

What are my options here?
Any thoughts will help
Thanks.

==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@java.sun.com ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@java.sun.com
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@java.sun.com
©2008 junlu.com - Jax Systems, LLC, U.S.A.