How to configure “Cross-cell single sign-on” in WebSphere with Jython

To configure "Cross-cell single sign-on" in the WebSphere 6.1 admin console with a Jython script, you can use the script below. This assumes that you've exported the keys from the server you are going to connect to.

import java.lang.String as jstr
import java.util.Properties as jprops
import java.io as jio
import javax.management as jmgmt

keyfilepassword = "somepassword"

# Import LTPA Keys
AdminConfig.save(); # This needs to happen so you can write to the Security file.
keyFile = "C:/projects/custom-security/was61keys";
fin = jio.FileInputStream(keyFile);
wasdev61keys = jprops();
wasdev61keys.load(fin);
fin.close();
password = jstr(keyfilepassword).getBytes();
securityAdmin = AdminControl.queryNames('*:*,name=SecurityAdmin');
securityObjectName = jmgmt.ObjectName(securityAdmin);
params = [wasdev61keys, password];
signature = ['java.util.Properties', '[B'];
AdminControl.invoke_jmx(securityObjectName, 'importLTPAKeys', params, signature);

# Save Config at the end.
AdminConfig.save();

Leave a Reply