• No results found

Customizing the Colors

To change the background colors on the page, modify the color values in the <style> section of the

<head>.

2.3.3 Customizing Tooltip Text for Authentication Contracts

The strings that the users see when they mouse over the cards for authentication contracts can be customized. If you need to support only one language, modify the text in the Administration Console.

1 In the Administration Console, click Devices > Identity Servers > Edit > Local > Contracts.

2 Click the name of a contract, then click Authentication Card.

3 Replace the English text in the Text option with the required language, then click OK.

4 Repeat Step 2 and Step 3 for each contract in the list.

5 Click OK, then update the Identity Server.

If you need to support multiple languages, you need to localize the tooltips. The nidsCardText attribute of the nidsAuthLocalContract object needs to be changed to a resource ID. The following procedure explains how to do this in the Administration Console. You can also use an LDAP browser.

1 In the Administration Console, click Devices > Identity Servers > Edit > Local > Contracts.

2 Click the name of a contract, then click Authentication Card.

3 Replace the text in the Text option with a resource ID.

For example, replace Name/Password - Form with CUSTOM_NamePwdFormToolTip.

4 Click OK.

5 Repeat Step 2 through Step 4 for each contract in the list.

6 Click OK, then update the Identity Server.

7 Use custom string resource files to define the localized strings:

7a Change to the WEB-INF/classes directory.

7b For each supported language, create a properties file. For example:

nidp_custom_resources_fr.properties nidp_custom_resources_es.properties

If you have already created these files for custom messages (see Section 2.3.1,

“Customizing Messages,” on page 82), use the existing files.

7c For each resource ID you have created, add an entry that contains the resource ID and the text you want displayed for that language. For example:

CUSTOM_NamePwdFormToolTip=Forma de Nombre/Clave 7d Repeat Step 7c for each supported language file.

8 Restart Tomcat.

Š Linux Identity Server: Enter one of the following commands:

/etc/init.d/novell-idp restart rcnovell-idp restart

Š Windows Identity Server: Enter the following commands:

net stop Tomcat7 net start Tomcat7

2.4 Sample Custom Login Pages

Š Section 2.4.1, “Modified login.jsp File for Credential Prompts,” on page 86

Š Section 2.4.2, “Custom nidp.jsp File with Custom Credentials,” on page 89

Š Section 2.4.3, “Custom 3.1 login.jsp File,” on page 95

Š Section 2.4.4, “Custom 3.0 login.jsp File,” on page 98

NOTE: After customizing a JSP file, you need to sanitize the JSP file to prevent XSS attacks. See, Section 2.5, “Preventing Cross-site Scripting Attacks,” on page 101.

2.4.1 Modified login.jsp File for Credential Prompts

The following code is a modified version of the 3.1 login.jsp file. It has been modified to add a prompt for the user’s email address.

Such a JSP file must be used with a contract that uses a method that defines the query for the new attribute. The method also needs to define which login file has been modified to display the prompt.

For more information about this process, see “Customizing the Default Login Page to Prompt for Different Credentials” on page 63.

The sample code contains the following the text for the prompt:

<td align=left>

<label>Email Address:</label>

</td>

It also adds an input element for the query variable:

<td align=left>

<input type="text" class="smalltext" name="Ecom_User_Mail" size="30">

</td>

These elements are both part of the new <tr> element that has been added to the file. These lines are marked in bold in the following sample file.

<%@ page language="java" %>

ContentHandler handler = new ContentHandler(request,response);

String target = (String) request.getAttribute("target");

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//

<%=handler.getLanguageCode()%>">

<html lang="<%=handler.getLanguageCode()%>">

<head>

<META HTTP-EQUIV="Content-Language"

CONTENT="<%=handler.getLanguageCode()%>">

<meta http-equiv="content-type" content="text/html;charset=utf-8">

<style type="text/css" media="screen">

td label { font-size: 0.85em ; padding-right: 0.2em; } label { font-size: 0.77em; padding-right: 0.2em; } input { font-family: sans-serif; }

.instructions { color: #4d6d8b; font-size: 0.8em; margin: 0 10px 10px 0 } </style>

<script type="text/javascript" src="<%=

handler.getImage("showhide_2.js",false)%>"></script>

<script language="JavaScript">

var i = 0;

<body style="background-color: <%=handler.getBGColor()%>" marginwidth="0"

marginheight="0" leftmargin="0" topmargin="0" rightmargin="0"

onLoad="document.IDPLogin.Ecom_User_ID.focus();" >

<form name="IDPLogin" enctype="application/x-www-form-urlencoded"

method="POST" action="<%= (String) request.getAttribute("url") %>"

AUTOCOMPLETE="off">

<input type="hidden" name="option" value="credential">

<% if (target != null) { %>

<input type="hidden" name="target" value="<%=target%>">

<% } %>

<table border=0 style="margin-top: 1em" width="100%" cellspacing="0"

cellpadding="0">

<tr>

<td style="padding: 0px">

<table border=0>

<tr>

<td align=left>

<label><%=handler.getResource(JSPResDesc.USERNAME)%></label>

</td>

String err = (String) request.getAttribute(NIDPConstants.ATTR_LOGIN_ERROR);

if (err != null) {

%>

<td style="padding: 10px">

<div class="instructions"><%=err%></div>

</td>

2.4.2 Custom nidp.jsp File with Custom Credentials

To create a custom nidp.jsp file that uses custom credentials, you need to modify the nidp.jsp file, create a method and contract for the file, and modify the main.jsp file. For instructions, see

“Customizing the nidp.jsp File” on page 65 and “Adding Logic to the main.jsp File” on page 75.

Figure 2-4 illustrates the login page that the following custom nidp.jsp file and main.jsp file create.

Figure 2-4 Custom Branding with Custom Credential Prompts

The credential frame uses the same modifications in the sample from Section 2.4.1, “Modified login.jsp File for Credential Prompts,” on page 86. The following sections provide the other required sample files to create this login page and information about the required method and contract: