Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Upgrade and Migration Guide

- Previous: Application Root Context and Access URL
- Next: Migrating Proprietary Extensions

## Applications With Form-based Authentication

Applications developed on Application Server 6.5 that use form-based authentication can pass the request parameters to the Authentication Form or the Login page. The Login page could be customized to display the authentication parameters based on the input parameters.

For example:

`http://gatekeeper.uk.sun.com:8690/NASApp/test/secured/page.jsp?arg1=test&arg2=m`

Application Server 8.1 does not support the passing of request parameters while displaying the Login page. The applications that uses form-based authentication, which passes the request parameters can not be migrated to Application Server 8.1. Porting such applications to Application Server 8.1 requires significant changes in the code. Instead, you can store the request parameter information in the session, which can be retrieved while displaying the Login page.

The following code example demonstrates the workaround:

Before changing the code in 6.5:

    ---------index-65.jsp -----------
    <%@page contentType="text/html"%>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    go to the <a href="secured/page.htm">secured a rea</a>
    </body>
    </html>
    ----------login-65.jsp--------------
    <%@page contentType="text/html"%>
    <html>
    <head> </head>
    <body>
    <!-- Print login form -->
    <h3>Parameters</h3><br>
    out.println("arg1 is " + request.getParameter("arg1"));
    out.println("arg2 is " + request.getParameter("arg2"));
    </body>
    </html>

After changing the code in Application Server 8.1:

    ---------index-81.jsp -----------
    <%@page contentType="text/html"%>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <%session.setAttribute("arg1","test"); %>
    <%session.setAttribute("arg2","me"); %>
    go to the <a href="secured/page.htm">secured area</a>
    </body>
    </html>

The `index-81.jsp` shows how you can store the request parameters in a session.

    ----------login-81.jsp--------------
    <%@page contentType="text/html"%>
    <html>
    <head> </head>
    <body>
    <!-- Print login form -->
    <h3>Parameters</h3><br>
    <!--retrieving the parameters from the session -->
    out.println("arg1 is"+(String)session.getAttribute("arg1"));
    out.println("arg2 is” + (String)session.getAttribute("arg2"));
    </body>
    </html>

- Previous: Application Root Context and Access URL
- Next: Migrating Proprietary Extensions

- © 2010, Oracle Corporation and/or its affiliates