Package org.springframework.security.ldap

Examples of org.springframework.security.ldap.DefaultLdapUsernameToDnMapper


        template.bind("cn=clowns,ou=testgroups", group, null);

        group.setAttributeValue("cn", "acrobats");
        template.bind("cn=acrobats,ou=testgroups", group, null);

        mgr.setUsernameMapper(new DefaultLdapUsernameToDnMapper("ou=test people","uid"));
        mgr.setGroupSearchBase("ou=testgroups");
        mgr.setGroupRoleAttributeName("cn");
        mgr.setGroupMemberAttributeName("member");
        mgr.setUserDetailsMapper(new PersonContextMapper());
    }
View Full Code Here


        SecurityContextHolder.clearContext();
    }

    @Test
    public void testLoadUserByUsernameReturnsCorrectData() {
        mgr.setUsernameMapper(new DefaultLdapUsernameToDnMapper("ou=people","uid"));
        mgr.setGroupSearchBase("ou=groups");
        LdapUserDetails bob = (LdapUserDetails) mgr.loadUserByUsername("bob");
        assertEquals("bob", bob.getUsername());
        assertEquals("uid=bob,ou=people,dc=springframework,dc=org", bob.getDn());
        assertEquals("bobspassword", bob.getPassword());
View Full Code Here

        mgr.loadUserByUsername("jim");
    }

    @Test
    public void testUserExistsReturnsTrueForValidUser() {
        mgr.setUsernameMapper(new DefaultLdapUsernameToDnMapper("ou=people","uid"));
        assertTrue(mgr.userExists("bob"));
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.ldap.DefaultLdapUsernameToDnMapper

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.