@Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth .ldapAuthentication() .userDnPatterns("uid={0},ou=people") .groupSearchBase("ou=groups") .contextSource() .url("ldap://localhost:8389/dc=springframework,dc=org") .and() .passwordCompare() .passwordEncoder(new LdapShaPasswordEncoder()) .passwordAttribute("userPassword"); }
LOG.debug("Setting up LDAP authentication against {}.", providerUrl); auth.ldapAuthentication() .userDnPatterns(userDnPatterns) .userSearchBase(userSearchBase) .userSearchFilter(userSearchFilter)
@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { if (ShepherConstants.LOGIN_TYPE_LDAP.equals(loginType.toUpperCase())) { auth.ldapAuthentication() .userDnPatterns("uid={0},ou=people") .groupSearchBase("ou=groups") .contextSource() .url(ldapUrl) .managerPassword(ldapPassword) .managerDn(ldapDn); } else if (ShepherConstants.LOGIN_TYPE_DEMO.equals(loginType.toUpperCase())) { auth.inMemoryAuthentication() .withUser(demoAdminName) .password(demoAdminPassword) .roles("USER"); } } }
.userSearchFilter(environment.getProperty("security.providers[" + providerIdx + "].user-search-filter")); } else { ldapAuthenticationProviderConfigurer.userDnPatterns(userDNPattern);
.userDetailsContextMapper(new LdapUserDetailsService(ldapAppProperties)) .rolePrefix("") .userDnPatterns(ldapAppProperties.getUserDnPattern()) .groupRoleAttribute(ldapAppProperties.getGroupRoleAttribute()) .groupSearchBase(ldapAppProperties.getGroupSearchBase())
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { if(Boolean.parseBoolean(ldapEnabled)) { auth .ldapAuthentication() .contextSource() .url(ldapUrls + ldapBaseDn) .managerDn(ldapSecurityPrincipal) .managerPassword(ldapPrincipalPassword) .and() .userDnPatterns(ldapUserDnPattern); } else { auth .inMemoryAuthentication() .withUser("user").password("password").roles("USER") .and() .withUser("admin").password("admin").roles("ADMIN"); } }
ldapConfigurer.userDnPatterns(ldapSecurityProperties.getUserDnPattern());