Search in sources :

Example 11 with RMAuthentication

use of org.ow2.proactive.resourcemanager.authentication.RMAuthentication in project scheduling by ow2-proactive.

the class SchedulerStarter method startResourceManager.

private static void startResourceManager(final int numberLocalNodes, final int nodeTimeoutValue) {
    final Thread rmStarter = new Thread() {

        public void run() {
            try {
                // Starting a local RM using default deployment descriptor
                RMFactory.setOsJavaProperty();
                LOGGER.info("Starting the resource manager...");
                RMAuthentication rmAuth = RMFactory.startLocal();
                if (numberLocalNodes > 0) {
                    addLocalNodes(rmAuth, numberLocalNodes, nodeTimeoutValue);
                }
                LOGGER.info("The resource manager with " + numberLocalNodes + " local nodes created on " + rmAuth.getHostURL());
            } catch (AlreadyBoundException abe) {
                LOGGER.error("The resource manager already exists on local host", abe);
                System.exit(4);
            } catch (Exception aoce) {
                LOGGER.error("Unable to create local resource manager", aoce);
                System.exit(5);
            }
        }
    };
    rmStarter.start();
}
Also used : RMAuthentication(org.ow2.proactive.resourcemanager.authentication.RMAuthentication) AlreadyBoundException(java.rmi.AlreadyBoundException) LoginException(javax.security.auth.login.LoginException) KeyException(java.security.KeyException) URISyntaxException(java.net.URISyntaxException) InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) ParseException(org.apache.commons.cli.ParseException) InvalidScriptException(org.ow2.proactive.scripting.InvalidScriptException) SocketException(java.net.SocketException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) ProActiveException(org.objectweb.proactive.core.ProActiveException) AlreadyBoundException(java.rmi.AlreadyBoundException)

Example 12 with RMAuthentication

use of org.ow2.proactive.resourcemanager.authentication.RMAuthentication in project scheduling by ow2-proactive.

the class AuthenticationTest method loginScenarios.

@Test
public void loginScenarios() throws Exception {
    RMAuthentication auth = rmHelper.getRMAuth();
    rmHelper.disconnect();
    loginAsAdmin(auth);
    loginAsUser(auth);
    loginIncorrectAdminPassword(auth);
    loginIncorrectUserPassword(auth);
}
Also used : RMAuthentication(org.ow2.proactive.resourcemanager.authentication.RMAuthentication) RMFunctionalTest(functionaltests.utils.RMFunctionalTest) Test(org.junit.Test)

Example 13 with RMAuthentication

use of org.ow2.proactive.resourcemanager.authentication.RMAuthentication in project scheduling by ow2-proactive.

the class AuthenticationTest method loginIncorrectAdminPassword.

private void loginIncorrectAdminPassword(RMAuthentication auth) throws KeyException {
    // negative
    log("Test 3");
    log("Trying to authorized with incorrect user name and password");
    try {
        Credentials cred = Credentials.createCredentials(new CredData(TestUsers.DEMO.username, "b"), auth.getPublicKey());
        auth.login(cred);
        fail("Error: successful authentication");
    } catch (LoginException e) {
        log("Passed: expected error " + e.getMessage());
    }
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) LoginException(javax.security.auth.login.LoginException) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Example 14 with RMAuthentication

use of org.ow2.proactive.resourcemanager.authentication.RMAuthentication in project scheduling by ow2-proactive.

the class AuthenticationTest method loginAsUser.

private void loginAsUser(RMAuthentication auth) throws LoginException, KeyException {
    log("Test 2");
    log("Trying to authorized with correct user name and password");
    Credentials cred = Credentials.createCredentials(new CredData(TestUsers.USER.username, TestUsers.USER.password), auth.getPublicKey());
    ResourceManager user = auth.login(cred);
    user.disconnect().getBooleanValue();
    log("Passed: successful authentication");
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Example 15 with RMAuthentication

use of org.ow2.proactive.resourcemanager.authentication.RMAuthentication in project scheduling by ow2-proactive.

the class RMProxyUserInterfaceTest method createRMCachingProxyUserInterface.

private RMListenerProxy createRMCachingProxyUserInterface() throws Exception {
    RMListenerProxy proxyUserInterface = PAActiveObject.newActive(RMListenerProxy.class, new Object[] {});
    final RMAuthentication auth = rmHelper.getRMAuth();
    final PublicKey pubKey = auth.getPublicKey();
    final Credentials adminCreds = Credentials.createCredentials(new CredData(TestUsers.TEST.username, TestUsers.TEST.password), pubKey);
    proxyUserInterface.init(RMTHelper.getLocalUrl(), adminCreds);
    return proxyUserInterface;
}
Also used : RMListenerProxy(org.ow2.proactive.resourcemanager.common.util.RMListenerProxy) RMAuthentication(org.ow2.proactive.resourcemanager.authentication.RMAuthentication) PublicKey(java.security.PublicKey) CredData(org.ow2.proactive.authentication.crypto.CredData) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Aggregations

RMAuthentication (org.ow2.proactive.resourcemanager.authentication.RMAuthentication)17 Credentials (org.ow2.proactive.authentication.crypto.Credentials)16 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)14 CredData (org.ow2.proactive.authentication.crypto.CredData)13 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)7 PublicKey (java.security.PublicKey)7 Test (org.junit.Test)7 Node (org.objectweb.proactive.core.node.Node)6 JMXServiceURL (javax.management.remote.JMXServiceURL)5 LoginException (javax.security.auth.login.LoginException)5 File (java.io.File)4 HashMap (java.util.HashMap)4 MBeanServerConnection (javax.management.MBeanServerConnection)4 ObjectName (javax.management.ObjectName)4 JMXConnector (javax.management.remote.JMXConnector)4 ParseException (org.apache.commons.cli.ParseException)3 IOException (java.io.IOException)2 KeyException (java.security.KeyException)2 AttributeList (javax.management.AttributeList)2 CommandLine (org.apache.commons.cli.CommandLine)2