Custom Authentication module accessing customer properties in custom java code
search cancel

Custom Authentication module accessing customer properties in custom java code

book

Article ID: 111923

calendar_today

Updated On:

Products

CA Identity Manager CA Identity Governance CA Identity Portal

Issue/Introduction

How to access custom auth module properties from java code...

The customer poses the following question:
As of 14.2 there is now a way to add Authentication module properties in the management console.

How do I access those properties programmatically from inside my Java module?

I'd like to use that new functionality to remove some hardcoded values from my code, and put them in the management console.

Environment

Release:
Component: IDMGR

Resolution

Although accessing the custom auth module properties from java code has not been tested or QA'd, Engineering suggests it might be possible possible through programming using IM llsdk6 API to modify the authentication module properties.


For example:

import com.netegrity.llsdk6.imsapi.ImsEnvironment;
import com.netegrity.llsdk6.imsapi.metadata.AuthModulePropertiesDefinition;
import com.netegrity.llsdk6.imsapi.metadata.UserConsoleDefinition;
import com.netegrity.llsdk6.imsapi.provider.EnvironmentSettingsProvider;
import com.netegrity.llsdk6.imsapi.type.LoginAuthenticationModule;
import com.netegrity.llsdk6.imsapi.utility.ActiveDirectoryAuthenticationProperties;
import com.netegrity.llsdk6.imsimpl.ImsApiImpl;
import com.netegrity.llsdk6.imsimpl.ImsImplKeys;
import com.netegrity.llsdk6.imsimpl.jdbcmanagedobject.JDBCManagedObjectProvider;


JDBCManagedObjectProvider<?> envProvider = ImsApiImpl.getJDBCManagedObjectProvider(ImsImplKeys.IMS_ENVIRONMENT);
for (ImsEnvironment env : (List<ImsEnvironment>)envProvider.findAll(null)) {
EnvironmentSettingsProvider prov = env.getEnvironmentSettingsProvider();

try {
UserConsoleDefinition ucdef = prov.getUserConsoleDefinition();
if (ucdef != null) {
String aclass = ucdef.getAuthClass();
if (aclass != null && aclass.equals(LoginAuthenticationModule.AD.getClassName())) {
AuthModulePropertiesDefinition amdef = prov.getAuthModulePropertiesDefinition(LoginAuthenticationModule.AD.getCode());
if (amdef != null && amdef.getAuthModuleProperties(false).isEmpty()) {
Map<String, String> admap = new HashMap<String, String>(adSettings.size());
for (String key : ActiveDirectoryAuthenticationProperties.AD_PROPERTIES_TOSET) {
String value = adSettings.get(key);
if (value != null)
admap.put(key, value);
}
amdef.setAuthModuleProperties(admap, true);
amdef.modifyObject();
ret = true;
envProvider.clearCache(env.getUniqueName());
logger.info("Migrated AD Authentication module settings from properties file into environment " + env.getFriendlyName());
}
}
}
} catch (Exception e) {
deleteADSettingsFile = false;
logger.error("migrateADAuthenticationSettings() failed to migrate AD settings into environment " + env.getFriendlyName(), e);
}
}