The following is a Java
example of a GetInfo method call. The method is issued twice. The
first time it is issued, it gets identity information for the connected
user. The second time, it gets identity information for a credentialed
user. The example includes code that formats and prints the information
returned by the two requests:
public void getInfo() throws Exception {
try
{
// Defines the GetIdentityInfo “ReturnUnrestrictedSource” option.
final String[][] options ={{"ReturnUnrestrictedSource",""}};
System.out.println(""); // Skip a line
System.out.println("<<<< Begin getInfo() >>>>" );
// Defines a stringholder for the info output parameter.
VariableArray2dOfStringHolder info = new VariableArray2dOfStringHolder();
// Issues the GetInfo method for the current iSecurity connection user.
iSecurity.GetInfo("GetIdentityInfo","", options, info);
String[][] returnArray = info.value;
System.out.println();
// Specifies a title for the output.
System.out.println("<<<<<< getInfo() for ISecurity Connection User >>>>>>");
System.out.println("credHandle=''");
for (int i=0; i< returnArray.length; i++ )
{
System.out.println(returnArray[i][0] + "=" + returnArray[i][1]);
}
// Defines a stringholder for the credential handle.
StringHolder credHandle = new StringHolder();
// Issues the GetCredentials method.
iSecurity.GetCredentials(testUserId, credHandle);
// Issues the GetInfo method for the credentialed user
iSecurity.GetInfo("GetIdentityInfo",credHandle.value, options, info);
returnArray = info.value;
System.out.println();
// Skip one line
// Specifies a title to print in the output.
System.out.println("<<<<<< getInfo() for Credentialed User >>>>>>");
System.out.println("credHandle=" + credHandle.value);
for (int i=0; i< returnArray.length; i++ )
{
System.out.println(returnArray[i][0] + "=" + returnArray[i][1]);
}
// Issues the FreeCredentials method.
iSecurity.FreeCredentials(credHandle.value);
System.out.println("");
// Skip a line
System.out.println("<<<< End getInfo() >>>>" );
}
// The following code catches the method's exceptions.
catch (Exception e) {
System.out.println("GetInfo: Exceptions");
e.printStackTrace();
throw e;
}
}
Here is the output from
the requests:
<<<< Begin getInfo() >>>>
<<<<<< getInfo() for ISecurity Connection User >>>>>>
credHandle=''
UserClass=Unrestricted, Trusted
AuthenticatedUserid=TESTUSR7@CARYNT
IdentityName=PUBLIC
IdentityType=IdentityGroup
IdentityObjectID=A5CY5BIY.A3000002
UnrestrictedSource=ConfigFile
<<<<<< getInfo() for Credentialed User >>>>>>
credHandle=2d91581c00000000
UserClass=IdentityAdmin
AuthenticatedUserid=TESTUSER@SASPW
IdentityName=testUser
IdentityType=Person
IdentityObjectID=A5CY5BIY.AN000003
<<<< End getInfo() >>>>