Package org.acegisecurity.providers.ldap.authenticator

Examples of org.acegisecurity.providers.ldap.authenticator.BindAuthenticator


              new FilterBasedLdapUserSearch(searchBase,
              searchFilter,
              initialDirContextFactory);
          userSearch.setSearchSubtree(true);
         
          BindAuthenticator authenticator = new BindAuthenticator(initialDirContextFactory);
          authenticator.setUserSearch(userSearch);
          authenticator.setUserDnPatterns(new String [] { "uid={0},ou=users"} );
         
          String groupSearchBase = "ou=groups";
          DefaultLdapAuthoritiesPopulator authoritiesPopulator =
            new DefaultLdapAuthoritiesPopulator(initialDirContextFactory,
                groupSearchBase);
          String groupRoleAttribute = "ou";
          authoritiesPopulator.setGroupRoleAttribute(groupRoleAttribute);
           
            System.out.println("***********************************");
          LdapAuthenticationProvider ldapAuthenticationProvider =
            new LdapAuthenticationProvider(authenticator, authoritiesPopulator);
          LdapUserInfo user = authenticator.authenticate(userDetails.getUsername(),
              (String)authentication.getCredentials());
          if (user != null) {
              UserDetails u = ldapAuthenticationProvider.retrieveUser(userDetails.getUsername(),
                  authentication);         
              System.out.println("user " + u);
View Full Code Here

TOP

Related Classes of org.acegisecurity.providers.ldap.authenticator.BindAuthenticator

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.