Search in sources :

Example 1 with ServerInstanceAction

use of com.sun.identity.security.ServerInstanceAction in project OpenAM by OpenRock.

the class AdminUtils method initialize.

public static void initialize() {
    debug = Debug.getInstance(IUMSConstants.UMS_DEBUG);
    try {
        DSConfigMgr dscMgr = DSConfigMgr.getDSConfigMgr();
        ServerInstance svrInstance = dscMgr.getServerInstance(LDAPUser.Type.AUTH_ADMIN);
        if (svrInstance != null) {
            adminDN = svrInstance.getAuthID();
            String adminPW = (String) AccessController.doPrivileged(new ServerInstanceAction(svrInstance));
            adminPassword = xor(adminPW.getBytes());
        } else {
            debug.error("AdminUtils.initialize: server instance not found");
        }
    } catch (LDAPServiceException e) {
        if (SystemProperties.isServerMode()) {
            debug.error("AdminUtils.initialize: Initialize admin info ", e);
        } else if (debug.messageEnabled()) {
            debug.message("AdminUtilsinitialize: Could not initialize admin info message:" + e.getMessage());
        }
    }
}
Also used : ServerInstanceAction(com.sun.identity.security.ServerInstanceAction) DSConfigMgr(com.iplanet.services.ldap.DSConfigMgr) LDAPServiceException(com.iplanet.services.ldap.LDAPServiceException) ServerInstance(com.iplanet.services.ldap.ServerInstance)

Example 2 with ServerInstanceAction

use of com.sun.identity.security.ServerInstanceAction in project OpenAM by OpenRock.

the class DSConfigMgr method getNewFailoverConnectionFactory.

/**
     * This method give a failover connection. The list of servers in a server
     * group are used to failover.
     * 
     * @param serverGroupID
     *            The serverGroup for which the connection is required.
     * @param type
     *            The type of the user authentication that is required.
     * @see com.iplanet.services.ldap.LDAPUser.Type
     */
private ConnectionFactory getNewFailoverConnectionFactory(String serverGroupID, LDAPUser.Type type) throws LDAPServiceException {
    debugger.message("in DSConfigMgr.getNewFailoverConnection()");
    String hostName = getHostName(serverGroupID);
    if (hostName.length() == 0) {
        throw new LDAPServiceException(getString(IUMSConstants.DSCFG_SERVER_NOT_FOUND));
    }
    if (debugger.messageEnabled()) {
        debugger.message("Hostname =" + hostName);
    }
    ServerInstance sCfg = getServerInstance(serverGroupID, type);
    String authID = null;
    String passwd = null;
    // Let user name and password be null for anonymous auth type
    if (!type.equals(LDAPUser.Type.AUTH_ANONYMOUS)) {
        authID = sCfg.getAuthID();
        passwd = (String) AccessController.doPrivileged(new ServerInstanceAction(sCfg));
    }
    return LDAPUtils.newFailoverConnectionFactory(getLdapUrls(serverGroupID, Server.Type.CONN_SSL.equals(sCfg.getConnectionType())), authID, passwd != null ? passwd.toCharArray() : null, 0, null, Options.defaultOptions());
}
Also used : ServerInstanceAction(com.sun.identity.security.ServerInstanceAction)

Example 3 with ServerInstanceAction

use of com.sun.identity.security.ServerInstanceAction in project OpenAM by OpenRock.

the class DataLayer method getInstance.

/**
     * Create the singleton DataLayer object if it doesn't exist already.
     *
     * @supported.api
     */
public static synchronized DataLayer getInstance(ServerInstance serverCfg) throws UMSException {
    // Make sure only one instance of this class is created.
    if (m_instance == null) {
        String host = "localhost";
        int port = 389;
        String pUser = "";
        String pPwd = "";
        if (serverCfg != null) {
            host = serverCfg.getServerName();
            port = serverCfg.getPort();
            pUser = serverCfg.getAuthID();
            pPwd = (String) AccessController.doPrivileged(new ServerInstanceAction(serverCfg));
        }
        m_instance = new DataLayer(pUser, pPwd, host, port);
        ConfigurationObserver.getInstance().addListener(configListener);
        // Start the EventService thread if it has not already started.
        initializeEventService();
    }
    return m_instance;
}
Also used : ServerInstanceAction(com.sun.identity.security.ServerInstanceAction) ByteString(org.forgerock.opendj.ldap.ByteString)

Aggregations

ServerInstanceAction (com.sun.identity.security.ServerInstanceAction)3 DSConfigMgr (com.iplanet.services.ldap.DSConfigMgr)1 LDAPServiceException (com.iplanet.services.ldap.LDAPServiceException)1 ServerInstance (com.iplanet.services.ldap.ServerInstance)1 ByteString (org.forgerock.opendj.ldap.ByteString)1