Thursday, May 31, 2012

Sample External Login.jsp page for Oracle Access Manager 11g

One of the more popular posts on our blog was a post I made a while back about how to configure OAM 11g to use an externally hosted custom login page and how to write such a login page.

When I originally wrote that post I included only snippets from a JSP page that represents an external OAM login form.

I have updated that post with a full sample login.jsp that functions as an external login form for OAM 11g.  The code is also included below.

To review, to work as an external login form the login page code must do the following:

• You need to post back to the OAM server to the URI: “/oam/server/auth_cred_submit”. Note that in my sample, I’m posting to a load balancer VIP over SSL which will route the post to one of the OAM servers in my cluster.

• You need to post variables “username” and “password”

• You need code that will grab the request_id off of the query string and post it (as a hidden form variable) as well.

The Code

    <%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
    String error=request.getParameter("error");
    if(error==null || error=="null"){
    String paramName = "request_id";
    String reqId  = request.getParameter( paramName );

    <title>User Login JSP</title>
    function trim(s)
    return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );

    function validate()
    alert("Login empty");
    return false;
    else if(trim(document.frmLogin.sPwd.value)=="")
    alert("password empty");
    return false;

    <p>Acme Clinical Applications Login Screen - OAM edition</p>
    <form name="frmLogin" onSubmit="return validate();" action="" method="post">
        User Name<input type="text" name="username"/><br/>Password &nbsp;<input type="password"
        <input name="request_id" value="<%=reqId%>" type="hidden">  <br/>
        <input type="submit" name="sSubmit" value="Submit"/>

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.