• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BaseLdapPathContextSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: build

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


示例2: createLdapAuthenticator

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的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


示例3: createPasswordCompareAuthenticator

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


示例4: getLdapUserSearches

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
@Override
public List<FilterBasedLdapUserSearch> getLdapUserSearches(ContextSource ctx, LdapSetting settings) {
    SearchPattern searchPattern = settings.getSearch();
    String searchBase = searchPattern.getSearchBase();
    if (searchBase == null) {
        searchBase = "";
    }
    ArrayList<FilterBasedLdapUserSearch> result = new ArrayList<>();
    FilterBasedLdapUserSearch userSearch = new FilterBasedLdapUserSearch(searchBase,
            searchPattern.getSearchFilter(), (BaseLdapPathContextSource) ctx);
    userSearch.setSearchSubtree(searchPattern.isSearchSubTree());
    result.add(userSearch);
    return result;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:15,代码来源:CoreAddonsImpl.java


示例5: LdapFullDnSearch

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public LdapFullDnSearch(BaseLdapPathContextSource contextSource) {
    super(null, contextSource);
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:4,代码来源:LdapFullDnSearch.java


示例6: UasLdapUserSearch

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public UasLdapUserSearch(String searchFilter, BaseLdapPathContextSource contextSource) {
    notNull(contextSource, () -> new BadArgument("contextSource must not be null"));

    this.searchFilter = searchFilter;
    this.contextSource = contextSource;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:7,代码来源:UasLdapUserSearch.java


示例7: KerberosFilterBasedLdapUserSearch

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public KerberosFilterBasedLdapUserSearch(String searchFilter, BaseLdapPathContextSource contextSource) {
    super(searchFilter, contextSource);
    notNull(searchFilter, () -> new BadArgument("searchFilter must not be null."));
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:5,代码来源:KerberosFilterBasedLdapUserSearch.java


示例8: SemossBindAuthenticator

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public SemossBindAuthenticator( BaseLdapPathContextSource contextSource ) {
	super( contextSource );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:4,代码来源:SemossBindAuthenticator.java


示例9: DhisBindAuthenticator

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public DhisBindAuthenticator( BaseLdapPathContextSource contextSource )
{
    super( contextSource );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:5,代码来源:DhisBindAuthenticator.java


示例10: contextSource

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
@Bean
public BaseLdapPathContextSource contextSource() {
    return new DefaultSpringSecurityContextSource(url);
}
 
开发者ID:osiam,项目名称:auth-server,代码行数:5,代码来源:LdapAuthentication.java


示例11: getContextSource

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
private BaseLdapPathContextSource getContextSource() throws Exception {
    if (contextSource == null) {
        contextSource = contextSourceBuilder.build();
    }
    return contextSource;
}
 
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:7,代码来源:LdapAuthenticationProviderConfigurer.java


示例12: contextSource

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
@Bean
public BaseLdapPathContextSource contextSource() {
    return new DefaultSpringSecurityContextSource(serverUrl);
}
 
开发者ID:osiam,项目名称:osiam,代码行数:5,代码来源:LdapAuthentication.java


示例13: AmbariLdapBindAuthenticator

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public AmbariLdapBindAuthenticator(BaseLdapPathContextSource contextSource,
                                   Configuration configuration) {
  super(contextSource);
  this.configuration = configuration;
}
 
开发者ID:telefonicaid,项目名称:fiware-cosmos-ambari,代码行数:6,代码来源:AmbariLdapBindAuthenticator.java


示例14: SimpleBindAunthenticator

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public SimpleBindAunthenticator(BaseLdapPathContextSource contextSource, String gizmoGroup) {
    super(contextSource);
    this.gizmoGroup = gizmoGroup;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:5,代码来源:SimpleBindAunthenticator.java


示例15: authenticate

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
@Override
public DirContextOperations authenticate(Authentication authentication) {
    DirContextOperations user = null;
    Assert.isInstanceOf(UsernamePasswordAuthenticationToken.class, authentication,
            "Can only process UsernamePasswordAuthenticationToken objects");

    String username = authentication.getName();
    String password = (String) authentication.getCredentials();

    if (StringUtils.isEmpty(password)) {
        LOG.debug("Rejecting empty password for user " + username);
        throw new BadCredentialsException(messages.getMessage("BindAuthenticator.emptyPassword",
                "Empty Password"));
    }

    // If DN patterns are configured, try authenticating with them directly
    for (String dn : getUserDns(username)) {
        user = bindWithDn(dn, username, password);

        if (user != null) {
            break;
        }
    }

    // Otherwise use the configured search object to find the user and authenticate with the returned DN.
    if (user == null && getUserSearch() != null) {
        DirContextOperations userFromSearch = getUserSearch().searchForUser(username);
        user = bindWithDn(userFromSearch.getDn().toString(), username, password);
    }

    try {
        if (user != null && StringUtils.isNotEmpty(gizmoGroup)) {
            BaseLdapPathContextSource ctxSource = (BaseLdapPathContextSource) getContextSource();
            DirContext ctx = ctxSource.getReadOnlyContext();

            DistinguishedName userDn = new DistinguishedName(user.getDn());
            userDn.prepend(ctxSource.getBaseLdapPath());

            SearchControls controls = new SearchControls();
            controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
            String filter = String.format(GROUP_SEARCH_QUERY, gizmoGroup, userDn.toCompactString());
            NamingEnumeration en = ctx.search("", filter, controls);
            if (!en.hasMore()) {
                throw new BadCredentialsException(
                        messages.getMessage("BindAuthenticator.badCredentials", "Bad credentials"));
            }
        }
    } catch (javax.naming.NamingException ex) {
        throw new BadCredentialsException("Couldn't check group membership");
    }

    if (user == null) {
        throw new BadCredentialsException(
                messages.getMessage("BindAuthenticator.badCredentials", "Bad credentials"));
    }

    return user;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:59,代码来源:SimpleBindAunthenticator.java


示例16: LdapUserManager

import org.springframework.ldap.core.support.BaseLdapPathContextSource; //导入依赖的package包/类
public LdapUserManager(BaseLdapPathContextSource contextSource) {
	this.contextSource = contextSource;
	users = new FilterBasedLdapUserSearch("", Constants.LDAP_USER_SEARCH_FILTER, contextSource);
	
}
 
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:6,代码来源:LdapUserManager.java


示例17: createBindAuthenticator

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IQTypeFilter类代码示例发布时间:2022-05-21
下一篇:
Java LLDP类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap