13.07.2015 Views

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Any other Web component can access the object during the session to getthe attribute.Part of the Java code for PostLoginFilter represents the steps describedabove.Example 4-6 PostLoginFilter sample codepublic void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)//.....// Create attribute in HttpSession object and set its value to "UNDEFINED"HttpSession session = ((HttpServletRequest) request).getSession();session.setAttribute("userTYPE", "UNDEFINED");//let the j_security_check to do it's workchain.doFilter(request, response);//.....//perform LDAP retrievaluserLDAPAttributes = new LDAPAttr(cfg_server, cfg_port, cfg_basedn);userLDAPAttributes.SetUser(userName, cfg_attr);if (userLDAPAttributes.RetrieveLDAPAttributes() == 0) {user_attr = userLDAPAttributes.GetUserAttr();//Update session object attributesession.setAttribute("userTYPE", user_attr);System.out.println("Attrbute in the session object was set to: "+ (session.getAttribute("userTYPE")).toString());else {filterConfig.getServletContext().log("Problems retrieving attributes for " + userName);}//.....In the filter source code, extensive comments have been provided in order toclearly explain the filter behavior. Please refer to the filter code in theapplication for more information.Filter configurationWe have used <strong>WebSphere</strong> Studio Application Developer to install and configurethe filter in the Web deployment descriptor.1. Open the Web deployment descriptor in <strong>WebSphere</strong> Studio.2. Select the Filters tab and click Add under the Filters section. The Filter TypeSelection windows should be opened.Chapter 4. Securing Web components 65

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

Saved successfully!

Ooh no, something went wrong!