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.

employeeType will be stored as a session attribute and used by other Web<br />

components. Specify the employeeType attribute for the application users in<br />

the LDAP directory.<br />

3. LDAP is configured to accept anonymous access.<br />

4. The example implemented in this book has the users defined in both local<br />

operating system user registry and in the LDAP server. Users are registered<br />

under the o=itso suffix.<br />

Developing the LDAP query code<br />

The example filter included in the application code contains the following Java<br />

files.<br />

►<br />

►<br />

LDAPAttr.java is utilized to connect to the LDAP server and retrieve user<br />

attributes. Parameters that are passed to the class are set up in the filter<br />

configuration section in Web deployment descriptor and are passed to the<br />

constructor of the class while it is created. The class implements the simplest<br />

way to read user attributes from the LDAP server.<br />

PostLoginFilter.java is the actual filter code that uses the LDAPAttr to<br />

access certain attributes in the LDAP directory. This class implements the<br />

doFilter(request, response, filterchain) method. In this method, the actual<br />

filter action is performed, which is also the method that the upstream filter<br />

calls in order to pass the processing to the next filter in a chain. FilterChain<br />

object provides the information about the next filter to call.<br />

The sample doFilter method does the following:<br />

a. Checks if the Web container successfully initialized the filter. The Web<br />

container calls the init method of the filter to instantiate it.<br />

b. Reads the init parameters of the filter that have been provided in the<br />

section of the Web deployment descriptor.<br />

c. Gets the user name from the HTTP request object and creates the session<br />

attribute in the HttpSession object. This attribute is initially set to<br />

UNDEFINED.<br />

d. The filter lets the j_security_check perform the actions by calling the<br />

doFilter method.<br />

e. After returning from j_security_check, the PostLoginFilter performs an<br />

LDAP search for the user name that was provided in the HTTP request to<br />

the login form.<br />

f. After a successful search for the user in the LDAP directory, the<br />

employeeType attribute is read for the user and the session object is<br />

updated with the result.<br />

64 <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!