WebFacetsHOW-TOsAuthentication
YourKit Java Profiler |
AuthAndSessionIMPORTANT NOTE : as of v1.3.5, all this has been removed from WebFacets (I choose to remove it before people starts using it really). The ProfileLoaderFilter is not a very good answer to the authentication problems, it's very basic, so you should instead use Acegi if you want to have a really nice authentication mechanism back your facets ! Check out the docs here. WebFacets includes an optional user session management module, which provides transparent mechanisms for automatically associating user profiles to incoming requests. Using this module allows to obtain the currnt profile from anywhere in the web tier and use it to retrieve/execute facets. The authentication process itself is up to you, the system only handles loading of a profile for an incoming request if possible (based on some cookie), and binds it as a request attribute.
This module has not been heavily tested, and should not be used in critical projects. For more advanced security stuff and integration with "J2EE security standards", have a look at the following pages : The ProblemMany applications require authentication before the user can access all or parts of the WebApp. Most of the times, you have to enter a login/password or such stuff to access your private data, perform operations on them etc. Since this is pretty close to the whole profiles story (and also because I need this feature in an app I currently develop ;-P), I've chosen to include a small (and optional) authentication module to WebFacets. Basically, it should allow stateless/long-term sessions, based on a long-term cookie mechanism. Of course, the authentication process itself is up to you, there is no restriction for this. The Authentication and Session features simply manages the cookies etc. for you, nothing more. Using a filter : ProfileLoaderFilerCookie handling etc is done transparently via a new Servlet Filter (class
The filter is already functional, only a small bit of configuration has to be done (see below) to get it working. The filter uses another component to store the Filter ConfigurationThe
Here below is an example web.xml fragment (from the ReflectionFacets? demo) : <filter> <display-name>ProfileLoaderFilter</display-name> <filter-name>ProfileLoaderFilter</filter-name> <filter-class>net.sourceforge.jfacets.web.auth.ProfileLoaderFilter</filter-class> <init-param> <param-name>loginUrl</param-name> <param-value>/auth/login.jsp</param-value> </init-param> <init-param> <param-name>excludeList</param-name> <param-value>.css,index,test0,test1,test2,test3,login</param-value> </init-param> </filter> <filter-mapping> <filter-name>ProfileLoaderFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ProfileLoaderFilter</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> |