Package org.apache.qpid.server.security.auth.sasl.crammd5

Examples of org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HexSaslServer


        perform(TEST_USER, getHash(TEST_PASSWORD));
    }

    public void perform(String user, char[] password) throws Exception
    {
        CRAMMD5HexInitialiser initialiser = new CRAMMD5HexInitialiser();

        PrincipalDatabase db = new Base64MD5PasswordFilePrincipalDatabase();
        db.open(_file);
        initialiser.initialise(db);

        PasswordCallback passwordCallback = new PasswordCallback("password:", false);
        NameCallback usernameCallback = new NameCallback("user:", user);

        Callback[] callbacks = new Callback[]{usernameCallback, passwordCallback};

        assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
        initialiser.getCallbackHandler().handle(callbacks);

        assertArrayEquals(toHex(password), passwordCallback.getPassword());
    }
View Full Code Here


    @Override
    protected void setUp() throws Exception
    {
        super.setUp();

        CRAMMD5HexInitialiser _initializer = new CRAMMD5HexInitialiser();

        //Use properties to create a PrincipalDatabase
        Base64MD5PasswordFilePrincipalDatabase db = createTestPrincipalDatabase();
        assertEquals("Unexpected number of test users in the db", 2, db.getUsers().size());

        _initializer.initialise(db);

        _saslFactory = new CRAMMD5HexServerFactory();

        _saslServer = _saslFactory.createSaslServer(CRAMMD5HexSaslServer.MECHANISM,
                "AMQP",
                "localhost",
                null,
                _initializer.getCallbackHandler());
        assertNotNull("Unable to create saslServer with mechanism type " + CRAMMD5HexSaslServer.MECHANISM, _saslServer);

    }
View Full Code Here

    {
        CRAMMD5HashedInitialiser crammd5HashedInitialiser = new CRAMMD5HashedInitialiser();
        crammd5HashedInitialiser.initialise(this);
        _callbackHandlerMap.put(CRAMMD5HashedSaslServer.MECHANISM, crammd5HashedInitialiser.getCallbackHandler());

        CRAMMD5HexInitialiser crammd5HexInitialiser = new CRAMMD5HexInitialiser();
        crammd5HexInitialiser.initialise(this);
        _callbackHandlerMap.put(CRAMMD5HexSaslServer.MECHANISM, crammd5HexInitialiser.getCallbackHandler());

        _mechanismsString = CRAMMD5HashedSaslServer.MECHANISM + " " + CRAMMD5HexSaslServer.MECHANISM;
    }
View Full Code Here

        perform(user, password);
    }

    public void perform(String user, String password)
    {
        CRAMMD5HexInitialiser initialiser = new CRAMMD5HexInitialiser();

        //Use properties to create a PrincipalDatabase
        Properties users = new Properties();
        users.put(user, password);

        PropertiesPrincipalDatabase db = new PropertiesPrincipalDatabase(users);

        initialiser.initialise(db);

        //setup the callbacks
        PasswordCallback passwordCallback = new PasswordCallback("password:", false);
        NameCallback usernameCallback = new NameCallback("user:", user);

        Callback[] callbacks = new Callback[]{usernameCallback, passwordCallback};

        //Check the
        try
        {
            assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
            initialiser.getCallbackHandler().handle(callbacks);
        }
        catch (IOException e)
        {
            fail(e.getMessage());
        }
View Full Code Here

    {
        CRAMMD5HashedInitialiser crammd5HashedInitialiser = new CRAMMD5HashedInitialiser();
        crammd5HashedInitialiser.initialise(this);
        _callbackHandlerMap.put(CRAMMD5HashedSaslServer.MECHANISM, crammd5HashedInitialiser.getCallbackHandler());

        CRAMMD5HexInitialiser crammd5HexInitialiser = new CRAMMD5HexInitialiser();
        crammd5HexInitialiser.initialise(this);
        _callbackHandlerMap.put(CRAMMD5HexSaslServer.MECHANISM, crammd5HexInitialiser.getCallbackHandler());

    }
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        super.setUp();

        CRAMMD5HexInitialiser _initializer = new CRAMMD5HexInitialiser();

        //Use properties to create a PrincipalDatabase
        Base64MD5PasswordFilePrincipalDatabase db = createTestPrincipalDatabase();
        assertEquals("Unexpected number of test users in the db", 2, db.getUsers().size());

        _initializer.initialise(db);

        _saslFactory = new CRAMMD5HexServerFactory();

        _saslServer = _saslFactory.createSaslServer(CRAMMD5HexSaslServer.MECHANISM,
                "AMQP",
                "localhost",
                _initializer.getProperties(),
                _initializer.getCallbackHandler());
        assertNotNull("Unable to create saslServer with mechanism type " + CRAMMD5HexSaslServer.MECHANISM, _saslServer);

    }
View Full Code Here

        perform(user, password);
    }

    public void perform(String user, String password)
    {
        CRAMMD5HexInitialiser initialiser = new CRAMMD5HexInitialiser();

        //Use properties to create a PrincipalDatabase
        Properties users = new Properties();
        users.put(user, password);

        PropertiesPrincipalDatabase db = new PropertiesPrincipalDatabase(users);

        initialiser.initialise(db);

        //setup the callbacks
        PasswordCallback passwordCallback = new PasswordCallback("password:", false);
        NameCallback usernameCallback = new NameCallback("user:", user);

        Callback[] callbacks = new Callback[]{usernameCallback, passwordCallback};

        //Check the
        try
        {
            assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
            initialiser.getCallbackHandler().handle(callbacks);
        }
        catch (IOException e)
        {
            fail(e.getMessage());
        }
View Full Code Here

        perform(user, password);
    }

    public void perform(String user, String password)
    {
        CRAMMD5HexInitialiser initialiser = new CRAMMD5HexInitialiser();

        //Use properties to create a PrincipalDatabase
        Properties users = new Properties();
        users.put(user, password);

        PropertiesPrincipalDatabase db = new PropertiesPrincipalDatabase(users);

        initialiser.initialise(db);

        //setup the callbacks
        PasswordCallback passwordCallback = new PasswordCallback("password:", false);
        NameCallback usernameCallback = new NameCallback("user:", user);

        Callback[] callbacks = new Callback[]{usernameCallback, passwordCallback};

        //Check the
        try
        {
            assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
            initialiser.getCallbackHandler().handle(callbacks);
        }
        catch (IOException e)
        {
            fail(e.getMessage());
        }
View Full Code Here

        CRAMMD5HashedInitialiser cram = new CRAMMD5HashedInitialiser();
        cram.initialise(this);
        _saslServers.put(cram.getMechanismName(), cram);

        //Add the Hex initialiser
        CRAMMD5HexInitialiser cramHex = new CRAMMD5HexInitialiser();
        cramHex.initialise(this);
        _saslServers.put(cramHex.getMechanismName(), cramHex);

        //fixme The PDs should setup a PD Mangement MBean
//        try
//        {
//            _mbean = new AMQUserManagementMBean();
View Full Code Here

        perform(TEST_USER, getHash(TEST_PASSWORD));
    }

    public void perform(String user, char[] password) throws Exception
    {
        CRAMMD5HexInitialiser initialiser = new CRAMMD5HexInitialiser();

        PrincipalDatabase db = new Base64MD5PasswordFilePrincipalDatabase();
        db.open(_file);
        initialiser.initialise(db);

        PasswordCallback passwordCallback = new PasswordCallback("password:", false);
        NameCallback usernameCallback = new NameCallback("user:", user);

        Callback[] callbacks = new Callback[]{usernameCallback, passwordCallback};

        assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
        initialiser.getCallbackHandler().handle(callbacks);

        assertArrayEquals(toHex(password), passwordCallback.getPassword());
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HexSaslServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.