Package org.springframework.ldap.core

Examples of org.springframework.ldap.core.AuthenticationSource


        SecurityContextHolder.clearContext();
    }

    @Test
    public void principalAndCredentialsAreEmptyWithNoAuthentication() {
        AuthenticationSource source = new SpringSecurityAuthenticationSource();
        assertEquals("", source.getPrincipal());
        assertEquals("", source.getCredentials());
    }
View Full Code Here


        assertEquals("", source.getCredentials());
    }

    @Test
    public void principalIsEmptyForAnonymousUser() {
        AuthenticationSource source = new SpringSecurityAuthenticationSource();

        SecurityContextHolder.getContext().setAuthentication(
                new AnonymousAuthenticationToken("key", "anonUser", AuthorityUtils.createAuthorityList("ignored")));
        assertEquals("", source.getPrincipal());
    }
View Full Code Here

        assertEquals("", source.getPrincipal());
    }

    @Test(expected=IllegalArgumentException.class)
    public void getPrincipalRejectsNonLdapUserDetailsObject() {
        AuthenticationSource source = new SpringSecurityAuthenticationSource();
        SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken(new Object(), "password"));

        source.getPrincipal();
    }
View Full Code Here

        source.getPrincipal();
    }

    @Test
    public void expectedCredentialsAreReturned() {
        AuthenticationSource source = new SpringSecurityAuthenticationSource();
        SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken(new Object(), "password"));

        assertEquals("password", source.getCredentials());
    }
View Full Code Here

    @Test
    public void expectedPrincipalIsReturned() {
        LdapUserDetailsImpl.Essence user = new LdapUserDetailsImpl.Essence();
        user.setUsername("joe");
        user.setDn(new DistinguishedName("uid=joe,ou=users"));
        AuthenticationSource source = new SpringSecurityAuthenticationSource();
        SecurityContextHolder.getContext().setAuthentication(
                new TestingAuthenticationToken(user.createUserDetails(), null));

        assertEquals("uid=joe,ou=users", source.getPrincipal());
    }
View Full Code Here

TOP

Related Classes of org.springframework.ldap.core.AuthenticationSource

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.