1

background

When OAM fails to log in, it will jump to the OAM error page, as shown in the figure

This page is OAM's standard error page, which is very unfriendly. When the user faces such a page, they don't know how to operate at all. Here is how to customize this page

accomplish

  • Download oam-server.ear

Log in to the OAM background, $MIDDLEWARE_HOME/Oracle_IAM1/oam/server/apps , and download it to the local

MIDDLEWARE_HOME is the middleware directory, such as /data/fmwhome/Oracle/Middleware/Oracle_IAM1/oam/server/apps
  • Modify page

Use decompression software (such as 7-zip, etc.) to decompress oam-server.ear to the directory. If there is no decompression software, you can directly use the jar command to decompress.

jar -xvf oam-server.ear

After decompression, there will be a ngsso-web.war file, decompress the file in the same way, in the path ngsso-web/pages directory, this directory contains all the OAM standard pages, provided by jsp, of which page defaultservererror.jsp is the error page, so only You need to modify this page. The page source code is as follows

<%@ page language="java" contentType="text/html" %>
<%@ page isErrorPage="true" import="java.io.*,oracle.security.am.engines.sso.ServerMsg" %>
<%@page import="oracle.security.am.common.utilities.constant.GenericConstants" %>
<%@page import="java.util.*, java.text.MessageFormat, oracle.security.am.engines.sso.ServerMsg"%>
<%@page import="oracle.security.am.common.utilities.css.XSSUtil" %>

<%@ include file="locale-ctx.jsp" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%!
public void jspInit(){
    oracle.security.am.pbl.transport.http.proxy.ServletCatalog.registerServlet("/pages/defaultservererror.jsp", this);
}
%>
<%
// if proxy loading, return immediately
if ("true".equals(request.getParameter("proxyloading")))
    return;
    
  //Set the Expires and Cache Control Headers
  response.setHeader("Cache-Control", "no-cache, no-store");
  response.setHeader("Pragma", "no-cache");
  response.setHeader("Expires", "0");
  //Added for Combating ClickJacking
  XSSUtil.addHeader(response, "");
  response.setContentType("text/html; charset=UTF-8");
 
  final String appName = request.getContextPath();
  //initializing the messageBundle first
  java.util.Locale myLocale = request.getLocale();
  String defaultResourceBundle = "oracle.security.am.engines.sso.ServerMsg";
  ResourceBundle msgBundle  = ResourceBundle.getBundle(defaultResourceBundle, myLocale);

  final String defaultErrorCode = "OAM-7";
  String simpleMessage = msgBundle.getString(defaultErrorCode);
  // if redirection due to error happened
  Object errCode = request.getAttribute(GenericConstants.ERROR_CODE);

  if(errCode != null) {
    try {
      simpleMessage = msgBundle.getString(errCode.toString());
    } 
    catch(Exception e) {
      //ignore. simpleMessage will be set to the default
    }
  }
    
%>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=language%>" lang="<%=language%>"  dir="<%=textDirection%>">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title><%=msgBundle.getString("SSO")%></title>
    <link rel='stylesheet' href='<%=request.getContextPath()%>/pages/css/login_page<%=cssPrefix%>.css'/>
   <!--...省略部分代码-->
    </div>
</body>
</html>

You can modify part of the html code as follows

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="refresh" content="0; URL=重定向的地址" />
</head>
</html>

Redirect the page to the specified page. The reason why it is recommended to redirect rather than modify it directly on jsp is because if the page is written in jsp, then each update needs to redeploy oam-server, if it is redirected to self The definition page is more flexible.

  • Repack

Just overwrite the jsp file in ear with the defaultservererror.jsp oam-server.ear/ngsso-web.war/pages/ with 7-zip software, and then directly drag the new jsp file into directly overwrite and save, if you don’t have 7-zip, you can use the following Command repack

jar -uvf ngsso-web.war pages/defaultservererror.jsp
jar -uvf oam-server.ear ngsso-web.war
  • deploy

Upload oam-server.ear to the server and overwrite the original ear file (!!! Be sure to back up the original one first). In addition, you need to delete all tmp folders under $DOMAIN_HOME/servers/oam_server1\tmp

  • Reboot

Restart all oam manager server


DQuery
300 声望94 粉丝

幸福是奋斗出来的