当前位置: 首页>>代码示例>>Java>>正文


Java LdapUserSearch类代码示例

本文整理汇总了Java中org.springframework.security.ldap.search.LdapUserSearch的典型用法代码示例。如果您正苦于以下问题:Java LdapUserSearch类的具体用法?Java LdapUserSearch怎么用?Java LdapUserSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LdapUserSearch类属于org.springframework.security.ldap.search包,在下文中一共展示了LdapUserSearch类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createUserSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
/**
 * Creates LDAP User search
 * @param properties Properties POJO
 * @return LDAP User search
 */
public static LdapUserSearch createUserSearch(LdapProperties properties, LdapContextSource source) {
    UserProperties userProperties = properties.getUser();

    switch (userProperties.getType()) {
        case kerberos:
            return ldapKerberosUserSearch(userProperties, source);
        case filter:
            return ldapFilteredUserSearch(userProperties, source);
        case dn:
            return ldapFullDnUserSearch(source);
        default:
            log.warn("Failed to create LDAP User search with type {}.", userProperties.getType());
            return null;
    }
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:21,代码来源:LdapFactory.java

示例2: LDAPAuthenticator

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
/**
 * Default constructor.
 * @param ldapSettings LDAP config map for an app
 */
public LDAPAuthenticator(Map<String, String> ldapSettings) {
	if (ldapSettings != null && ldapSettings.containsKey("security.ldap.server_url")) {
		String serverUrl = ldapSettings.get("security.ldap.server_url");
		String baseDN = ldapSettings.get("security.ldap.base_dn");
		String bindDN = ldapSettings.get("security.ldap.bind_dn");
		String basePass = ldapSettings.get("security.ldap.bind_pass");
		String searchBase = ldapSettings.get("security.ldap.user_search_base");
		String searchFilter = ldapSettings.get("security.ldap.user_search_filter");
		String dnPattern = ldapSettings.get("security.ldap.user_dn_pattern");
		String passAttribute = ldapSettings.get("security.ldap.password_attribute");
		boolean usePasswordComparison = ldapSettings.containsKey("security.ldap.compare_passwords");

		DefaultSpringSecurityContextSource contextSource =
				new DefaultSpringSecurityContextSource(Arrays.asList(serverUrl), baseDN);
		contextSource.setAuthenticationSource(new SpringSecurityAuthenticationSource());
		contextSource.setCacheEnvironmentProperties(false);
		if (!bindDN.isEmpty()) {
			contextSource.setUserDn(bindDN);
		}
		if (!basePass.isEmpty()) {
			contextSource.setPassword(basePass);
		}
		LdapUserSearch userSearch = new FilterBasedLdapUserSearch(searchBase, searchFilter, contextSource);

		if (usePasswordComparison) {
			PasswordComparisonAuthenticator p = new PasswordComparisonAuthenticator(contextSource);
			p.setPasswordAttributeName(passAttribute);
			p.setPasswordEncoder(new LdapShaPasswordEncoder());
			p.setUserDnPatterns(new String[]{dnPattern});
			p.setUserSearch(userSearch);
			authenticator = p;
		} else {
			BindAuthenticator b = new BindAuthenticator(contextSource);
			b.setUserDnPatterns(new String[]{dnPattern});
			b.setUserSearch(userSearch);
			authenticator = b;
		}
	}
}
 
开发者ID:Erudika,项目名称:para,代码行数:44,代码来源:LDAPAuthenticator.java

示例3: ldapKerberosUserSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
private static LdapUserSearch ldapKerberosUserSearch(UserProperties properties, LdapContextSource source) {
    KerberosFilterBasedLdapUserSearch search = new KerberosFilterBasedLdapUserSearch(
            properties.getFilter(), source
    );

    search.setSearchScope(SearchControls.SUBTREE_SCOPE);
    return search;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:9,代码来源:LdapFactory.java

示例4: createLdapAuthenticator

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:20,代码来源:LdapAuthenticationProviderConfigurer.java

示例5: createUserSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
private LdapUserSearch createUserSearch() {
    if (userSearchFilter == null) {
        return null;
    }
    return new FilterBasedLdapUserSearch(userSearchBase, userSearchFilter,
            contextSource);
}
 
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:8,代码来源:LdapAuthenticationProviderConfigurer.java

示例6: ldapFilteredUserSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
private static LdapUserSearch ldapFilteredUserSearch(UserProperties properties, LdapContextSource source) {
    return new FilterBasedLdapUserSearch(
            properties.getSearchBase(), properties.getFilter(), source
    );
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:6,代码来源:LdapFactory.java

示例7: ldapFullDnUserSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
private static LdapUserSearch ldapFullDnUserSearch(LdapContextSource source) {
    LdapFullDnSearch search = new LdapFullDnSearch(source);
    search.setSearchScope(SearchControls.OBJECT_SCOPE);
    return search;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:6,代码来源:LdapFactory.java

示例8: userSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
@ConditionalOnProperty(prefix = "security.ldap.user", name = "type")
@Bean
public LdapUserSearch userSearch() {
    return LdapFactory.createUserSearch(properties, contextSource());
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:6,代码来源:LdapConfiguration.java

示例9: userSearch

import org.springframework.security.ldap.search.LdapUserSearch; //导入依赖的package包/类
@Bean
public LdapUserSearch userSearch() {
    return new FilterBasedLdapUserSearch(
            configuration.getUserSearchBase(), configuration.getUserSearchFilter(),
            contextSource());
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:7,代码来源:LdapAuthenticationProviderConfiguration.java


注:本文中的org.springframework.security.ldap.search.LdapUserSearch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。