org.springframework.ldap.core.support.BaseLdapPathContextSource Java Examples

The following examples show how to use org.springframework.ldap.core.support.BaseLdapPathContextSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LdapAuthenticationProviderConfigurer.java    From gravitee-management-rest-api with Apache License 2.0 6 votes vote down vote up
private LdapAuthenticationProvider build() throws Exception {
    BaseLdapPathContextSource contextSource = getContextSource();
    LdapAuthenticator ldapAuthenticator = createLdapAuthenticator(contextSource);

    LdapAuthoritiesPopulator authoritiesPopulator = getLdapAuthoritiesPopulator();

    LdapAuthenticationProvider ldapAuthenticationProvider = new LdapAuthenticationProviderProxy(
            ldapAuthenticator, authoritiesPopulator);
    SimpleAuthorityMapper simpleAuthorityMapper = new SimpleAuthorityMapper();
    simpleAuthorityMapper.setPrefix(rolePrefix);
    simpleAuthorityMapper.afterPropertiesSet();
    ldapAuthenticationProvider.setAuthoritiesMapper(simpleAuthorityMapper);
    if (userDetailsContextMapper != null) {
        ldapAuthenticationProvider
                .setUserDetailsContextMapper(userDetailsContextMapper);
    }
    return ldapAuthenticationProvider;
}
 
Example #2
Source File: LdapSecurityConfiguration.java    From data-highway with Apache License 2.0 5 votes vote down vote up
@Bean
public LdapUserSearch userSearch(
    @Value("${ldap.searchBase}") String searchBase,
    @Value("${ldap.searchFilter}") String searchFilter,
    BaseLdapPathContextSource contextSource) {
  return new FilterBasedLdapUserSearch(searchBase, searchFilter, contextSource);
}
 
Example #3
Source File: FilterLdapByGroupUserSearch.java    From apollo with Apache License 2.0 5 votes vote down vote up
public FilterLdapByGroupUserSearch(String searchBase, String searchFilter,
    String groupBase, BaseLdapPathContextSource contextSource, String groupSearch,
    String rdnKey, String groupMembershipAttrName, String loginIdAttrName) {
  super(searchBase, searchFilter, contextSource);
  this.searchBase = searchBase;
  this.groupBase = groupBase;
  this.groupSearch = groupSearch;
  this.contextSource = contextSource;
  this.rdnKey = rdnKey;
  this.groupMembershipAttrName = groupMembershipAttrName;
  this.loginIdAttrName = loginIdAttrName;
}
 
Example #4
Source File: LdapAuthenticationProviderConfigurer.java    From gravitee-management-rest-api with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the {@link LdapAuthenticator} to use
 *
 * @param contextSource the {@link BaseLdapPathContextSource} to use
 * @return the {@link LdapAuthenticator} to use
 */
private LdapAuthenticator createLdapAuthenticator(
        BaseLdapPathContextSource contextSource) {
    AbstractLdapAuthenticator ldapAuthenticator = passwordEncoder == null ? createBindAuthenticator(contextSource)
            : createPasswordCompareAuthenticator(contextSource);
    LdapUserSearch userSearch = createUserSearch();
    if (userSearch != null) {
        ldapAuthenticator.setUserSearch(userSearch);
    }
    if (userDnPatterns != null && userDnPatterns.length > 0) {
        ldapAuthenticator.setUserDnPatterns(userDnPatterns);
    }
    return postProcess(ldapAuthenticator);
}
 
Example #5
Source File: LdapAuthenticationProviderConfigurer.java    From gravitee-management-rest-api with Apache License 2.0 5 votes vote down vote up
/**
 * Creates {@link PasswordComparisonAuthenticator}
 *
 * @param contextSource the {@link BaseLdapPathContextSource} to use
 * @return
 */
private PasswordComparisonAuthenticator createPasswordCompareAuthenticator(
        BaseLdapPathContextSource contextSource) {
    PasswordComparisonAuthenticator ldapAuthenticator = new PasswordComparisonAuthenticator(
            contextSource);
    if (passwordAttribute != null) {
        ldapAuthenticator.setPasswordAttributeName(passwordAttribute);
    }
    ldapAuthenticator.setPasswordEncoder(passwordEncoder);
    return ldapAuthenticator;
}
 
Example #6
Source File: LdapSecurityConfiguration.java    From data-highway with Apache License 2.0 4 votes vote down vote up
@Bean
public BindAuthenticator bindAuthenticator(BaseLdapPathContextSource contextSource, LdapUserSearch userSearch) {
  BindAuthenticator authenticator = new BindAuthenticator(contextSource);
  authenticator.setUserSearch(userSearch);
  return authenticator;
}
 
Example #7
Source File: DhisBindAuthenticator.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public DhisBindAuthenticator( BaseLdapPathContextSource contextSource )
{
    super( contextSource );
}
 
Example #8
Source File: LdapAuthenticationProviderConfigurer.java    From gravitee-management-rest-api with Apache License 2.0 4 votes vote down vote up
private BaseLdapPathContextSource getContextSource() throws Exception {
    if (contextSource == null) {
        contextSource = contextSourceBuilder.build();
    }
    return contextSource;
}
 
Example #9
Source File: LdapAuthentication.java    From osiam with MIT License 4 votes vote down vote up
@Bean
public BaseLdapPathContextSource contextSource() {
    return new DefaultSpringSecurityContextSource(serverUrl);
}
 
Example #10
Source File: PasswordComparisonAuthenticator.java    From ranger with Apache License 2.0 4 votes vote down vote up
public PasswordComparisonAuthenticator(
		BaseLdapPathContextSource contextSource) {
	super(contextSource);
}
 
Example #11
Source File: LdapAuthenticationProviderConfigurer.java    From gravitee-management-rest-api with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a {@link BindAuthenticator}
 *
 * @param contextSource the {@link BaseLdapPathContextSource} to use
 * @return the {@link BindAuthenticator} to use
 */
private BindAuthenticator createBindAuthenticator(
        BaseLdapPathContextSource contextSource) {
    return new BindAuthenticator(contextSource);
}