How to get login of currently logged in user in OIM?
707325Oct 21 2009 — edited Oct 22 2009Hi,
I am developing JSP in OIM and I would like to obtain data of currently logged in user*, it is possible through getSelfProfile() method ( tcUserOperationsIntf ), so far I have written the following code:
--------------------------------------------------------------------------
tcResultSet loggedUser = null;
tcUtilityFactory utilityFactory = null;
ConfigurationClient.ComplexSetting myConfig =
ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
final Hashtable env = myConfig.getAllSettings();
tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm", "PrivateKey");
utilityFactory = new tcUtilityFactory(env, moSignature);
tcUserOperationsIntf userIntf;
userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
loggedUser = userIntf.getSelfProfile();
String userLogin;
try
{
userLogin = loggedUser.getStringValue("Users.User ID");
System.out.println("User = "+userLogin);
}
catch (tcColumnNotFoundException e)
{
// TODO
}
--------------------------------------------------------------------------
The problem that this code always returns XELSYSADM, and NOT data for user who is really currently logged in. I think that this is because of the one line on code (marked as bold) where xelsysadm is passed to the moSignature variable. But without this line of code it is impossible (I think so...) to initialize tcUserOperationsIntf and use the getSelfProfile() method... and the circle is closed...
Had anyone similar scenario?
Thanks in advance!