Package org.springframework.security.ldap.authentication

Examples of org.springframework.security.ldap.authentication.UserDetailsServiceLdapAuthoritiesPopulator


        UserDetails user = mock(UserDetails.class);
        when(uds.loadUserByUsername("joe")).thenReturn(user);
        List authorities = AuthorityUtils.createAuthorityList("ROLE_USER");
        when(user.getAuthorities()).thenReturn(authorities);

        UserDetailsServiceLdapAuthoritiesPopulator populator = new UserDetailsServiceLdapAuthoritiesPopulator(uds);
        Collection<? extends GrantedAuthority> auths =  populator.getGrantedAuthorities(new DirContextAdapter(), "joe");

        assertEquals(1, auths.size());
        assertTrue(AuthorityUtils.authorityListToSet(auths).contains("ROLE_USER"));
    }
View Full Code Here


        if (ugServiceName != null) {
            // use local user group service for loading authorities
            GeoServerUserGroupService ugService;
            try {
                ugService = securityManager.loadUserGroupService(ugServiceName);
                authPopulator = new UserDetailsServiceLdapAuthoritiesPopulator(
                        ugService);
                provider = new LdapAuthenticationProvider(authenticator,
                        authPopulator);
            } catch (IOException e) {
                LOGGER.log(Level.SEVERE, String.format(
View Full Code Here

TOP

Related Classes of org.springframework.security.ldap.authentication.UserDetailsServiceLdapAuthoritiesPopulator

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.