1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| public class enabling {
public static String strUser = "Administrator";
public static String strCMS = "localhost";
public static String strPwd = "Password1";
public static String strEntr ="secEntreprise";
public static IInfoStore infoStore;
public static String secret;
public static void main(String[] args) throws SDKException {
System.out.println ("Connecting to: " + strCMS);
// Log in to CMS and get infoStore
ISessionMgr oSessionMgr;
IEnterpriseSession oEnterpriseSession;
IInfoObjects newTrusts;
oSessionMgr = CrystalEnterprise.getSessionMgr();
oEnterpriseSession = oSessionMgr.logon(strUser, strPwd, strCMS, "secEnterprise");
infoStore = (IInfoStore)oEnterpriseSession.getService("", "InfoStore");
System.out.println ("Connected with : " + strUser);
//IInfoObjects newTrusts = infoStore.newInfoObjectCollection();
newTrusts = (IInfoObjects)infoStore.query("Select SI_TRUSTED_AUTH_ENABLED FROM CI_SYSTEMOBJECTS WHERE SI_NAME='secENTERPRISE' ");
IsecEnterprise Trust = (IsecEnterprise) newTrusts;
System.out.println("current status is: " + Trust.isTrustedAuthenticationEnabled());
if (Trust.isTrustedAuthenticationEnabled())
Trust.setSharedSecret(secret);
else Trust.setTrustedAuthenticationEnabled(true);
Trust.setSharedSecret(secret);
infoStore.commit(newTrusts);
}
} |
Partager