Package org.apache.ace.authentication.processor.basicauth

Examples of org.apache.ace.authentication.processor.basicauth.BasicHttpAuthenticationProcessor


    /**
     * Tests that canHandle yields false for any object other than {@link HttpServletRequest}.
     */
    @Test(groups = { UNIT })
    public void testCanHandleDoesNotAcceptUnhandledContext() {
        assert new BasicHttpAuthenticationProcessor().canHandle(new Object()) == false;
    }
View Full Code Here


    public void testUpdatedDoesNotAcceptEmptyKeyUsername() throws ConfigurationException {
        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "");
        props.put(PROPERTY_KEY_PASSWORD, "foo");
       
        new BasicHttpAuthenticationProcessor().updated(props);
    }
View Full Code Here

    @Test(groups = { UNIT }, expectedExceptions = ConfigurationException.class)
    public void testUpdatedDoesNotAcceptMissingKeyUsername() throws ConfigurationException {
        Properties props = new Properties();
        props.put(PROPERTY_KEY_PASSWORD, "foo");
       
        new BasicHttpAuthenticationProcessor().updated(props);
    }
View Full Code Here

    @Test(groups = { UNIT }, expectedExceptions = ConfigurationException.class)
    public void testUpdatedDoesNotAcceptMissingKeyPassword() throws ConfigurationException {
        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "foo");
       
        new BasicHttpAuthenticationProcessor().updated(props);
    }
View Full Code Here

    public void testUpdatedDoesNotAcceptEmptyKeyPassword() throws ConfigurationException {
        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, "foo");
        props.put(PROPERTY_KEY_PASSWORD, "");
       
        new BasicHttpAuthenticationProcessor().updated(props);
    }
View Full Code Here

       
        Properties props = new Properties();
        props.put(PROPERTY_KEY_USERNAME, keyUsername);
        props.put(PROPERTY_KEY_PASSWORD, keyPassword);
       
        BasicHttpAuthenticationProcessor processor = new BasicHttpAuthenticationProcessor();

        processor.updated(props);
       
        // Test whether we can use the new properties...
        when(m_servletRequest.getHeader(AUTHORIZATION_HEADER)).thenReturn(createAuthHeaderValue("bob:secret"));
       
        User user = mock(User.class);
        when(user.getName()).thenReturn("bob");
        when(user.hasCredential(eq(keyPassword), eq("secret"))).thenReturn(Boolean.TRUE);

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

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

TOP

Related Classes of org.apache.ace.authentication.processor.basicauth.BasicHttpAuthenticationProcessor

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.