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

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


    /**
     * Tests that authenticating with a empty username will yield null.
     */
    @Test(groups = { UNIT })
    public void testAuthenticateEmptyUserNameYieldsNull() {
        User result = new PasswordAuthenticationProcessor().authenticate(m_userAdmin, "", "secret");
        assert result == null : "Expected no valid user to be returned!";
    }
View Full Code Here


        when(user.getName()).thenReturn("bob");
        when(user.hasCredential(eq("password"), eq("otherSecret"))).thenReturn(Boolean.TRUE);

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

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

        when(user.getName()).thenReturn("bob");
        when(user.hasCredential(eq("password"), eq("secret"))).thenReturn(Boolean.TRUE);

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

        User result = new PasswordAuthenticationProcessor().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

    /**
     * Tests that authenticating with a null password will yield null.
     */
    @Test(groups = { UNIT })
    public void testAuthenticateNullPasswordYieldsNull() {
        User result = new PasswordAuthenticationProcessor().authenticate(m_userAdmin, "bob", null);
        assert result == null : "Expected no valid user to be returned!";
    }
View Full Code Here

    /**
     * Tests that authenticating with a null username will yield null.
     */
    @Test(groups = { UNIT })
    public void testAuthenticateNullUserNameYieldsNull() {
        User result = new PasswordAuthenticationProcessor().authenticate(m_userAdmin, null, "secret");
        assert result == null : "Expected no valid user to be returned!";
    }
View Full Code Here

    /**
     * Tests that a class cast exception is thrown for invalid context when calling authenticate.
     */
    @Test(groups = { UNIT }, expectedExceptions = ClassCastException.class)
    public void testAuthenticateThrowsClassCastForInvalidContext() {
        new PasswordAuthenticationProcessor().authenticate(m_userAdmin, new Object(), "foo");
    }
View Full Code Here

    /**
     * Tests that authenticating an unknown user will yield null.
     */
    @Test(groups = { UNIT })
    public void testAuthenticateUnknownUserYieldsNull() {
        User result = new PasswordAuthenticationProcessor().authenticate(m_userAdmin, "alice", "secret");
        assert result == null : "Expected no valid user to be returned!";
    }
View Full Code Here

    /**
     * Tests that canHandle yields true for string and byte array.
     */
    @Test(groups = { UNIT })
    public void testCanHandleDoesAcceptStringAndByteArray() {
        assert new PasswordAuthenticationProcessor().canHandle("foo", "bar".getBytes()) : "Expected the processor to handle a byte array!";
    }
View Full Code Here

    /**
     * Tests that canHandle yields true for two strings.
     */
    @Test(groups = { UNIT })
    public void testCanHandleDoesAcceptTwoStrings() {
        assert new PasswordAuthenticationProcessor().canHandle("foo", "bar") : "Expected the processor to handle a string!";
    }
View Full Code Here

    /**
     * Tests that canHandle throws an {@link IllegalArgumentException} for an empty context.
     */
    @Test(groups = { UNIT }, expectedExceptions = IllegalArgumentException.class)
    public void testCanHandleDoesNotAcceptEmptyArray() {
        new PasswordAuthenticationProcessor().canHandle(new Object[0]);
    }
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.