Web Express Logon Tutorial

 

Approach 1: Replace the entire CMS with your own custom version of the servlet

This tutorial does not describe how to create a servlet, but the following are resources available to help you:

  • IBM Websphere Studio Application Developer: IBM Websphere Studio Application Developer is the core development environment from IBM. It helps you optimize and simplify J2EE and Web services development by offering best practices, templates, code generation, and the most comprehensive development environment in its class. For more information, refer to http://www.ibm.com/software/awdtools/studioappdev/ (opens new browser).
  • IBM developerWorks: IBM developerWorks is your one-stop developer source. It offers tutorials, training, sample code, CDs and downloads, and more. For more information, refer to http://www.ibm.com/developerworks/ (opens new browser).

If you decide to replace the entire CMS provided with Host On-Demand, you will need to use an HTTP parameter for requests and XML-formatted data for responses. Parameters are supplied to the CMS servlet via an HTTP request, and the response information is encapsulated into an XML-formatted object and returned to the caller.

HTTP request parameters
When Host On-Demand makes a request of the CMS, it applies the appropriate HTTP parameters to this request. This helps determine the needs of the request. Since it must be an HTTP request, the CMS request interface is built around a standard HTTP-style query. Following the HTTPS protocol and server address is the query character, a question mark, and then a list of keys and values. These keys and values are separated by the ampersand symbol. Within each key and value pair, the key and value are separated by the symbol for equality. A sample query may look like the following example:

https://www.ibm.com/authserver/servlet/cms?operation=1&destination=www.ibm.com/somehost&appid=tpf&authtype=AuthType_3270Host
The following table is a list of available keys:

Key Possible value
operation '1' -- Credential Mapping Request
destination This is the destination for which the credentials are being requested.
appid This is the host application ID for which the credentials are being requested.
authtype This is the type of authentication credentials being requested.
localid This optional value supplies the user's identification based on the local operating system. For now, this solution is supported only on the Windows operating system.

XML data response object
The CMS returns its response to the client in XML format in an effort to make the response information structured and extensible. This XML format provides a good base for allowing structured access to the return data today and provide for expansion and improvement in the future. The following XML schema defines the format of the XML document:

<schema targetNamespace=""
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="hod-sso-credential" type="hod-sso-credentialType" />
<complexType name="hod-sso-credentialType">
   <sequence>
     <element name="userid" type="string" /> 
     <element name="password" type="string" />
     <element name="status" type="string" />
   </sequence>
   <attribute name="version" type="string" />
   </complexType>
</schema>

Based on the above schema, the following code is a sample of the XML return document that is streamed over the HTTPS connection:

<?xml version="1.0"?>
<hod-sso-credential version="1.0" >
   <userid>&^$#^&</userid>
   <password>&^$#^&</password>
   <status>0</status>
</hod-sso-credential>

In the above code, the user ID and password elements return garbage characters because they are encrypted. Host On-Demand includes an object called com.ibm.com.eNetwork.HOD.common.PasswordCipher to accomplish this. It contains the following two methods:

public static String encrypt (String plainText)
This method returns an encrypted string passed as a parameter.
public static String decrypt (String cipherText)
This method reverses the encryption process by returning a decrypted string. If the cipherText was not encrypted using the encrypt method, it returns the original input string.

The status element provides the status of the return value. If the credential mapper query fails for any reason, this field reports that failure to the client. Failure codes are defined in the SSOConstants class, which serves as a static repository of related SSO static information. The following table contains the status code definitions:

Status code Description
0
Success
1
Unknown status code
2
Credential Mapper not found
3
Invalid network user ID
4
Invalid Application ID
5
Invalid server address
6
Database connection error
7
User ID not found in database
8
Exception
9
Invalid user ID
10
Passticket error
11
Timeout
12
Unexpected DCAS return code
13
API not supported
14
Bad URL
15
Unable to parse response
16
Local user ID not available
17
Duplicate XML tags
18
An exception occurred while processing the credential request
19
Network Security plug-in is not defined to the CMS

Back to top

BackNext