Package org.apache.ace.authentication.processor.password

Examples of org.apache.ace.authentication.processor.password.PasswordAuthenticationProcessor


    /**
     * Tests that canHandle throws an {@link IllegalArgumentException} for a null context.
     */
    @Test(groups = { UNIT }, expectedExceptions = IllegalArgumentException.class)
    public void testCanHandleDoesNotAcceptNull() {
        new PasswordAuthenticationProcessor().canHandle((Object[]) null);
    }
View Full Code Here


    /**
     * Tests that canHandle yields false for too few arguments.
     */
    @Test(groups = { UNIT })
    public void testCanHandleDoesNotAcceptSingleArgument() {
        assert new PasswordAuthenticationProcessor().canHandle(new Object()) == false : "Expected the processor to NOT handle any object!";
    }
View Full Code Here

    /**
     * Tests that canHandle yields false for a string and other object.
     */
    @Test(groups = { UNIT })
    public void testCanHandleDoesNotAcceptStringAndOtherObject() {
        assert new PasswordAuthenticationProcessor().canHandle("foo", new Object()) == false : "Expected the processor to NOT handle any object!";
    }
View Full Code Here

    /**
     * Tests that canHandle yields false for any object other than {@link HttpServletRequest}.
     */
    @Test(groups = { UNIT })
    public void testCanHandleDoesNotAcceptWrongTypes() {
        assert new PasswordAuthenticationProcessor().canHandle(new Object(), new Object()) == false : "Expected the processor to NOT handle any object!";
    }
View Full Code Here

        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, keyUsername);
        props.put(PROPERTY_KEY_PASSWORD, keyPassword);
        props.put(PROPERTY_PASSWORD_HASHMETHOD, "sha1");

        PasswordAuthenticationProcessor processor = new PasswordAuthenticationProcessor();

        processor.updated(props);

        byte[] hashedPw = DigestUtils.sha("secret");
       
        // Test whether we can use the new properties...
        User user = mock(User.class);
        when(user.getName()).thenReturn("bob");
        when(user.hasCredential(eq(keyPassword), eq(hashedPw))).thenReturn(Boolean.TRUE);

        when(m_userAdmin.getUser(eq(keyUsername), eq("bob"))).thenReturn(user);

        User result = processor.authenticate(m_userAdmin, "bob", "secret");
        assert result != null : "Expected a valid user to be returned!";
       
        assert "bob".equals(user.getName()) : "Expected bob to be returned!";
    }
View Full Code Here

        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "foo");
        props.put(PROPERTY_KEY_PASSWORD, "");
        props.put(PROPERTY_PASSWORD_HASHMETHOD, "none");
       
        new PasswordAuthenticationProcessor().updated(props);
    }
View Full Code Here

        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "");
        props.put(PROPERTY_KEY_PASSWORD, "foo");
        props.put(PROPERTY_PASSWORD_HASHMETHOD, "none");
       
        new PasswordAuthenticationProcessor().updated(props);
    }
View Full Code Here

        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "foo");
        props.put(PROPERTY_KEY_PASSWORD, "bar");
        props.put(PROPERTY_PASSWORD_HASHMETHOD, "");
       
        new PasswordAuthenticationProcessor().updated(props);
    }
View Full Code Here

    public void testUpdatedDoesNotAcceptMissingKeyPassword() throws ConfigurationException {
        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "foo");
        props.put(PROPERTY_PASSWORD_HASHMETHOD, "none");

        new PasswordAuthenticationProcessor().updated(props);
    }
View Full Code Here

    public void testUpdatedDoesNotAcceptMissingKeyUsername() throws ConfigurationException {
        Properties props = new Properties();
        props.put(PROPERTY_KEY_PASSWORD, "foo");
        props.put(PROPERTY_PASSWORD_HASHMETHOD, "none");

        new PasswordAuthenticationProcessor().updated(props);
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.authentication.processor.password.PasswordAuthenticationProcessor

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.