03.05.2015 Views

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.5.2 Custom login<br />

There are situations when the login facility, using the j_security_check servlet<br />

provided by <strong>WebSphere</strong>, does not fulfil all the requirements for the application. In<br />

these cases, developers can extend the login facility and develop an extension to<br />

the existing code.<br />

In the earlier versions of <strong>WebSphere</strong> Application Server, developers could use<br />

the Custom Login facility of <strong>WebSphere</strong>; which has been deprecated since<br />

version 4 of <strong>WebSphere</strong> Application Server.<br />

According to the new programming model, developers should use servlet filters<br />

to implement pre-login or post-login processes.<br />

The following section will provide a short introduction of servlet filters and a<br />

sample filter to perform post-login processing for the application.<br />

Using servlet filters to modify the login process<br />

Java Servlet API V 2.3 introduces a new object called a filter which can<br />

transform a request or modify a response or header information. Filters can be<br />

chained together to act on the input and output of a specified resource or group<br />

of resources. They do not usually create a response. The main role of filters is to<br />

modify or adapt the response. Typical uses of filters include:<br />

1. Logging information.<br />

2. Transforming the content on the fly (image transformation, encryption, XML<br />

transformation, compression, and so on).<br />

3. MIME type filters (functionally equivalent to the old-style servlet chaining).<br />

4. Customized authentication of Web resources.<br />

5. Caching information.<br />

A filter can be configured to act upon a certain request. A difference between<br />

JSP/servlet and filter processing is that filter can be mapped and work across the<br />

subset (or all) of the URLs served by the application.<br />

A filter’s lifecycle is very similar to a servlet’s. The configuration of all filters in a<br />

given Servlet container is kept in the FilterConfig object. Each filter can access<br />

this object in order to get the initialization parameters and a reference to the<br />

ServletContext and to load the information necessary for performing filter<br />

processing (for example, the data needed for filtering functions).<br />

62 <strong>IBM</strong> <strong>WebSphere</strong> <strong>V5.0</strong> <strong>Security</strong> Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!