Logging on using the Mashup Service authentication methods

You can use the IBM® Cognos® Mashup Service authentication methods to logon.

Important: If you use a custom authentication provider to handle authentication, the provider must be able to use form fields to authenticate users. For more information, see the topics on authentication request flow scenarios and the JDBCSample sample program in the IBM Cognos Custom Authentication Provider Developer Guide.

Use the auth/logon resource type, submitting a credentials element with the xmlData option.

You can determine which credentials the server requires by submitting an empty credentials element:

http://localhost/ibmcognos/bi/v1/disp/rds/auth/logon?
xmlData=<credentials/>

The server response is a credentialPrompt element that lists actualValue elements for which the server has values and missingValue elements whose values must be supplied.

You can then submit an auth/logon request with a credentials element that contains values for the missingValue elements.

If your logon attempt is successful, the server sends a response containing an accountInfo element.

If your logon request contains incorrect data, or still has missing values, the server response is another credentialPrompt element.

The following JavaScript code snippet illustrates how you can code a logon request.

To see this code in context, view the following sample:

installation_location/webcontent/samples/sdk/cms/javascript/authentication/reportOutput.html

function doLogon()
{
  var myNameSpace=document.getElementById("nameSpace").value;
    var myUserName=document.getElementById("userName").value;
    var myPassword=document.getElementById("password").value;

    var xmlData =
      "xmlData=<credentials>"
      +"<credentialElements><name>CAMNamespace</name><label>Namespace:</label>"
      +"<value><actualValue>"+myNameSpace+"</actualValue></value>"
      +"</credentialElements><credentialElements><name>CAMUsername</name><label>User ID:</label>"
      +"<value><actualValue>"+myUserName+"</actualValue></value>"
      +"</credentialElements><credentialElements><name>CAMPassword</name><label>Password:</label>"
      +"<value><actualValue>"+myPassword+"</actualValue></value>"
      +"</credentialElements></credentials>";

  try
  {
    objXHR.open("POST", parent.settings.document.getElementById("serverURL").value + 
"/rds/auth/logon", false);
    objXHR.send(xmlData);
    checkLoginStatus();

  }
  catch (e)
  {
    alert("Error occurs when doing logon.\r\n"+e);
  }

}