loginServiceManaged Method

This article contains the following topics:
casm173
This article contains the following topics:
The following parameters apply to the loginServiceManaged method:
Parameter
Type
Description
policy
String
(Required) Identifies the policy, which must be must be in plain text.
encrypted_policy
String
(Required) Identifies the digital signature of the policy code, encrypted with the policyholder’s private key. It is in BASE64 text format.
Description
Performs the user authentication by locating the policy through the plain text policy code, finding the policyholder’s public key associated with the policy, decrypting the encrypted policy code, matching decrypted content with the policy code, and finally, opening a session with a back-end server. The returned session ID (SID) can be used for subsequent web services method invocations. Proxy contact specified in the policy is responsible for all subsequent web service activities initiated. All function group security and data partition are enforced for the proxy contact defined in the policy.
It is also important to note that the encrypted_policy parameter is in the BASE64 text format, and it is necessary to perform proper conversion from the binary format. The SID should be freed with logout(). A SID may expire if it is not used before a timeout elapses.
Returns
The following is returned:
Parameter
Type
Description
SID
String
Identifies the unique session ID (SID) to use for all other Web Services calls. It is in plain text format.
Implement loginServiceManaged in Java
The following shows how to generate Certificates and then use these generated Certificates to access the CA SDM web services.
In the following example, the login process completes using the CA SDM Certificate and then performs two common web services calls. The getBopsid() web services method call allows you to obtain a token that is linked to a specific user. This token can be used to login to the CA SDM web interface as the linked user without being prompted for a password. This allows seamless integration to be enabled between different applications.
The generated BOPSID token expires after 30 seconds, so it must be used promptly.
Important!
There is a known issue when using the 1.4 version of the AXIS tool. For more information, see the
Release Notes
.
Follow these steps:
  1. Generate the stub classes with AIXS Tool WSDL2Java. For more information, see the Generating Stub Classes with AXIS Tool WSDL2Java section from the PKI_loginServiceManaged_JAVA_steps file. Find the file in the following location:
    $NX_ROOT/samples/sdk/websvc/java/test1_pki
  2. Start the CA SDM service.
  3. Run pdm_pki -p DEFAULT.
    DEFAULT.p12 is created in the current directory. This policy will have the password equal to the policy name (in this case DEFAULT).
    This command will also add the Certificate's public key to the field pub_key field (public_key attribute) in the sapolicy table/object.
  4. Log into CA SDM
  5. Select
    SOAP Web Services Policy
    ,
    Policies
    on the
    Administration
    tab.
    The
    SOAP Web Services Access Policy List
    page opens.
  6. Click
    DEFAULT
    .
    The
    SOAP Web Services Access Policy Detail
    page opens.
  7. Complete the
    Proxy Contact
    field (in this example, ServiceDesk) and confirm that the DEFAULT policy record Has Key field displays "Yes."
  8. Copy DEFAULT.p12 (from the directory where command pdm_pki is executed), the JSP file called
    pkilogin.jsp
    and the HTML file called
    pkilogin.htm
    (from the $NX_ROOT/samples/sdk/websvc/java/test1_pki directory) to the following directory:
    $NX_ROOT/bopcfg/www/CATALINA_BASE/webapps/axis
  9. Open the HTML form (from the axis directory). For example, http://localhost:8080/axis/pkilogin.htm
    Complete the appropriate fields.
    The Directory field identifies the location of the Certificate file. Modify the path to the correct location.
  10. Click Log me in!
    The results page opens.
  11. Click the BOPSID URL.
    Click this immediately! The BOPSID has a limited life token of about 30 seconds.
    The format of a URL using a BOPSID is as follows:
    http://<server name>:CA Portal/CAisd/pdmweb.exe?BOPSID=<BOPSID value>
In order to use the loginServiceManaged method for a Java client program running on AIX, you may need to replace a pair of security policy files within your JAVA_HOME. Go to http://www.ibm.com and search for "developerworks java technology security information AIX". In the "developerWorks : Java technology : Security" document, follow the link to "IBM SDK Policy files". Download the unrestricted policy files, local_policy.jar and US_export_policy.jar. Use these files to replace the original files in your JAVA_HOME/lib/security directory."
Generate Stub Classes with WSDL2Java
You can generate the stub classes for the CA SDM web services.
To generate stub classes with WSDL2Java
  1. Open a command prompt and navigate to the "<drive>:\program files\CA" directory.
    The directory appears.
  2. Run the dir /x command.
    The short form of the CA SDM directory appears. For example, the short name is "SERVIC~1."
  3. Search for javac.exe on all of the server's local drives. If you locate the file, make note of its location because you will need to reference it in a batch file.
    If you do not locate javac.exe, go to Http://java.sun.com and search for Java J2SE SDK to download. This may require a reboot.
  4. Build a batch file called build_wsdl.bat and place it in the following directory:
    $NX_ROOT\bopcfg\www\CATALINA_BASE\webapps\axis
  5. Use the following code for the batch file, updating the bold items as appropriate:
@echo off ::################################################################## ::# Simple bat file to Build Unicenter Service Desk Version 11.0 USD Stub classes ::# Use it to create the required USD Unicenter Service Desk Version 11.0 Java Web Services classes ::# ::# Usage: build_wsdl ::################################################################# @REM Update this with the PATH to USD NX_ROOT location @SET USD_SHORT_PATH=C:\Progra~1/CA/Servic~1/ @REM Update this with the PATH to the JDK javac.exe compiler @REM (this is used in the 2nd part of this file) @SET JAVAC_EXE="C:\j2sdk1.4.2_13\bin\javac.exe" @REM Update this to the path to the USD <USDK> <rellevel> NX_ROOT/java/lib location @SET USD_TOMCAT=%USD_SHORT_PATH%java/lib @SET CP=%USD_TOMCAT%/axis.jar;%USD_TOMCAT%/commons-discovery.jar;%USD_TOMCAT%/commons-logging.jar;%USD_TOMCAT%/jaxrpc.jar;%USD_TOMCAT%/saaj.jar;%USD_TOMCAT%/log4j-1.2.8.jar;%USD_TOMCAT%/xml-apis.jar;%USD_TOMCAT%/xercesImpl.jar;%USD_TOMCAT%/wsdl4j.jar;%USD_TOMCAT%/axis-ant.jar @REM Please specify the path to java.exe file below @REM You can obtain this by reviewing the NX.env file use the @NX_JRE_INSTALL_DUR @REM variable to derive this info @SET JAVA_PATH=C:\Program Files(x86)\CA\SC\JRE\1.6.0_30 @SET JAVA_EXE="%JAVA_PATH%\bin\java.exe" @cd WEB-INF\classes %JAVA_EXE% -cp %CP% org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/services/USD_Unicenter Service Desk Version 11.0_WebService?wsdl @cd ..\.. ::################################################################## ::# This next section compiles the Service Desk stub code ::# Once complete, you should recycle tomcat with the following ::# commands or by recycling Service Desk: ::# pdm_tomcat_nxd -c STOP ::# pdm_tomcat_nxd -c START ::################################################################## @SET CP=".\classes;%CP%" @SET STUBS_DIR=classes\com\ca\www\UnicenterServicePlus\ServiceDesk @cd WEB-INF %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\ArrayOfInt.java %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\ArrayOfString.java %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\ListResult.java %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\USD_WebService.java %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\USD_WebServiceLocator.java %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\USD_WebServiceSoap.java %JAVAC_EXE% -classpath %CP% -deprecation -d classes %STUBS_DIR%\USD_WebServiceSoapSoapBindingStub.java @cd ..
After running the batch file from the command prompt, the stub classes are in place and compiled.
  • Recycle Tomcat as follows:
    • pdm_tomcat_nxd -c STOP
    • pdm_tomcat_nxd -c START