@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"); }
.groupSearchFilter(groupSearchFilter) .groupSearchBase(groupSearchBase) .contextSource() .url(providerUrl) .managerDn(providerUserDn)
@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"); } } }
populator.setRolePrefix(""); ldapAuthenticationProviderConfigurer.ldapAuthoritiesPopulator(populator).contextSource(contextSource);
@Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth .ldapAuthentication() .userSearchFilter("(sAMAccountName={0})") .userSearchBase("OU=Mirante User,DC=miranteinfo,DC=com") .rolePrefix("ROLE_") .groupSearchBase("OU=GruposGS,DC=miranteinfo,DC=com") .groupSearchFilter("(member={0})") .userDetailsContextMapper(peticionamentoUserDetailService.orElseThrow(() -> SingularServerException.rethrow( String.format("Bean %s do tipo %s não pode ser nulo. Para utilizar a configuração de segurança %s é preciso declarar um bean do tipo %s identificado pelo nome %s .", SingularUserDetailsService.class.getName(), "SingularUserDetailsService", SingularMiranteADSpringSecurityConfig.class.getName(), SingularUserDetailsService.class.getName(), "SingularUserDetailsService" )) ) ) .contextSource() .managerDn("tomcatLogin") .managerPassword("jnditomcat") .root("DC=miranteinfo,DC=com") .url("ldap://LUA.miranteinfo.com:389/"); }
.groupRoleAttribute(ldapAppProperties.getGroupRoleAttribute()) .groupSearchBase(ldapAppProperties.getGroupSearchBase()) .contextSource() .url(ldapAppProperties.getUrl()) .managerDn(managerDn)
@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.contextSource().url(ldapSecurityProperties.getUrl().toString()) .managerDn(ldapSecurityProperties.getManagerDn()) .managerPassword(ldapSecurityProperties.getManagerPassword());