Sunday, May 4, 2014

OAM 11g R2 PS2 (11.1.2.2.0) Custom Login Page Development and Configuration

In this post I will cover the development and deployment of custom login page for authentication


First create a custom login page



<%@page language="java" session="true" contentType="text/html;charset=ISO-8859-1"  %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
getServerPort()+path+"/";
String reqToken = request.getParameter("reqToken");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<font color="blue">Please Enter User Name and Password </font><br><br>
<base href="<%=basePath%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Implementing css and javascript</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" href="style.css" type="text/css"></link>
<script language="JavaScript" type="text/JavaScript" src="validate.js"></script>
</head>

<form onSubmit="return validate(this)" action="http://deepak-pc.mydomain.com:14100/oam/server/auth_cred_submit" method="post">
<center>
<table border = "0">
      <tr align="left" valign="top">
            <td>User Name:</td>
            <td><input type="text" name ="username" class="inputbox"/></td>
      </tr>
      <tr align="left" valign="top">
            <td>Password:</td>
            <td><input type="password" name ="password" class="inputbox"/></td>
      </tr>
      <tr align="left" valign="top">
            <td> </td>
            <td><input type="hidden" name="request_id" value="<%=reqToken%>"></td>
      </tr>
      <tr align="left" valign="top">
            <td></td>
            <td><input type="submit" name="submit" value="submit" class="submitButton"/></td>
      </tr>
</table>
</center>
</form>



Deploy this within a war file along with any customization like css, js files etc.





I have deployed this onto oam_server1 and AdminServer
































Create a new Authentication Scheme for the custom login page as below































or you can try external context if you are pointing to a remote location








                                                                                                                                                               
                                                                                                                                          
                                                                                                                                                         


Modify the Application Domain to use the above authentication scheme in its authentication policy












Access the protected resource















Get redirected for authentication






















successful authentication





























if you change the context type to external in authentication scheme you will redirected to remote host for authentication