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


Java LdapContextSource.setPassword方法代码示例

本文整理汇总了Java中org.springframework.ldap.core.support.LdapContextSource.setPassword方法的典型用法代码示例。如果您正苦于以下问题:Java LdapContextSource.setPassword方法的具体用法?Java LdapContextSource.setPassword怎么用?Java LdapContextSource.setPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.ldap.core.support.LdapContextSource的用法示例。


在下文中一共展示了LdapContextSource.setPassword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startLDAPServer

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
@BeforeClass
public static void startLDAPServer() throws Exception {
    LdapTestUtils.startApacheDirectoryServer(PORT, baseName.toString(), "test", PRINCIPAL, CREDENTIALS, null);
    LdapContextSource contextSource = new LdapContextSource();
    contextSource.setUrl("ldap://127.0.0.1:" + PORT);
    contextSource.setUserDn("");
    contextSource.setPassword("");
    contextSource.setPooled(false);
    contextSource.afterPropertiesSet();

    // Create the Sprint LDAP template
    LdapTemplate template = new LdapTemplate(contextSource);

    // Clear out any old data - and load the test data
    LdapTestUtils.cleanAndSetup(template.getContextSource(), baseName, new ClassPathResource("ldap/testdata.ldif"));
    System.out.println("____________Started LDAP_________");
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:LDAPIdentityServiceImplTest.java

示例2: loadData

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
protected static void loadData() throws Exception
{
    // Bind to the directory
    LdapContextSource contextSource = new LdapContextSource();
    contextSource.setUrl("ldap://127.0.0.1:10389");
    contextSource.setUserDn("uid=admin,ou=system");
    contextSource.setPassword("secret");
    contextSource.setPooled(false);
    //contextSource.setDirObjectFactory(null);
    contextSource.afterPropertiesSet();

    // Create the Sprint LDAP template
    LdapTemplate template = new LdapTemplate(contextSource);

    // Clear out any old data - and load the test data
    LdapTestUtils.clearSubContexts(contextSource, LdapUtils.newLdapName("dc=example,dc=com"));
    LdapTestUtils.loadLdif(contextSource, new ClassPathResource("data.ldif"));
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:19,代码来源:BaseDAOTest.java

示例3: buildContextTemplate

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
private LdapTemplate buildContextTemplate ()
		throws Exception {
	LdapTemplate ldapSpringTemplate = new LdapTemplate();
	LdapContextSource contextSource = new LdapContextSource();

	contextSource.setUserDn( ldapUser );
	contextSource.setPassword( ldapPass );
	contextSource.setUrl( ldapUrl );

	// Critical: Spring beans must be initialized, and JavaConfig requires
	// explicity calls
	contextSource.afterPropertiesSet();
	ldapSpringTemplate.setContextSource( contextSource );
	ldapSpringTemplate.afterPropertiesSet();
	return ldapSpringTemplate;
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:17,代码来源:Spring_Ldap.java

示例4: init

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
@PostConstruct
protected void init() {
    if (webLdapConfig.getLdapEnabled()) {
        ldapContextSource = new LdapContextSource();

        checkRequiredConfigProperties(webLdapConfig);

        ldapContextSource.setBase(webLdapConfig.getLdapBase());
        List<String> ldapUrls = webLdapConfig.getLdapUrls();
        ldapContextSource.setUrls(ldapUrls.toArray(new String[ldapUrls.size()]));
        ldapContextSource.setUserDn(webLdapConfig.getLdapUser());
        ldapContextSource.setPassword(webLdapConfig.getLdapPassword());

        ldapContextSource.afterPropertiesSet();

        ldapTemplate = new LdapTemplate(ldapContextSource);
        ldapTemplate.setIgnorePartialResultException(true);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:LdapLoginProvider.java

示例5: init

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
    ldapContextSource = new LdapContextSource();

    checkRequiredConfigProperties(webLdapConfig);

    ldapContextSource.setBase(webLdapConfig.getLdapBase());
    List<String> ldapUrls = webLdapConfig.getLdapUrls();
    ldapContextSource.setUrls(ldapUrls.toArray(new String[ldapUrls.size()]));
    ldapContextSource.setUserDn(webLdapConfig.getLdapUser());
    ldapContextSource.setPassword(webLdapConfig.getLdapPassword());

    ldapContextSource.afterPropertiesSet();

    ldapTemplate = new LdapTemplate(ldapContextSource);
    ldapTemplate.setIgnorePartialResultException(true);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:LdapAuthProvider.java

示例6: SimpleLDAPAuthenticationProvider

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
public SimpleLDAPAuthenticationProvider(EntityManager entityManager,
		String ldapUrl, String ldapUserDn, String ldapPassword,
		String ldapBase, String ldapUid) throws Exception {

	this.entityManager = entityManager;
	this.ldapBase = ldapBase;
	this.ldapUid = ldapUid;

	LdapContextSource contextSource = new LdapContextSource();

	contextSource.setUrl(ldapUrl);
	contextSource.setUserDn(ldapUserDn);
	contextSource.setPassword(ldapPassword);
	contextSource.afterPropertiesSet();

	ldapTemplate = new LdapTemplate(contextSource);

	ldapTemplate.afterPropertiesSet();
}
 
开发者ID:mcraken,项目名称:spring-scaffy,代码行数:20,代码来源:SimpleLDAPAuthenticationProvider.java

示例7: LdapCredentialsAuthenticator

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
/**
 * This constructor creates a LdapCredentialsAuthenticator that authenticates against an LDAP server
 * that does not support anonymous requests
 *
 * @param ldapHost    the LDAP server host
 * @param ldapPort    the LDAP server port
 * @param usersOuPath the path for the organizational unit under which users are found
 * @param userDn      the distinguished name for the connection
 * @param password    the password for the connection
 */
public LdapCredentialsAuthenticator(final String ldapHost,
                                    final int ldapPort,
                                    final String usersOuPath,
                                    final String userDn,
                                    final String password) {
  Assert.hasText(ldapHost, "Invalid ldapHost");
  Assert.isTrue(ldapPort > 0);
  Assert.hasText(usersOuPath, "Invalid usersOuPath");
  Assert.hasText(userDn, "Invalid userDn");
  Assert.hasText(password, "Invalid password");

  final LdapContextSource contextSource = new LdapContextSource();
  contextSource.setUrl("ldap://" + ldapHost + ":" + ldapPort);
  contextSource.setBase(usersOuPath);
  contextSource.setUserDn(userDn);
  contextSource.setPassword(password);
  contextSource.afterPropertiesSet();

  ldapTemplate = new LdapTemplate(contextSource);
  this.id = calculateId(ldapHost, ldapPort, usersOuPath);
}
 
开发者ID:outbrain,项目名称:ob1k,代码行数:32,代码来源:LdapCredentialsAuthenticator.java

示例8: buildDB

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
@Before @Override
  public void buildDB() throws Exception {
  	super.buildDB ();

  	
// Bind to the LDAP directory:
final LdapContextSource contextSource = new LdapContextSource ();
contextSource.setUrl ("ldap://127.0.0.1:" + PORT + "/dc=inspire,dc=idgis,dc=eu");
contextSource.setUserDn (PRINCIPAL);
contextSource.setPassword (CREDENTIALS);
contextSource.setPooled (false);
contextSource.afterPropertiesSet ();

// Create an LDAP template:
ldapTemplate = new LdapTemplate (contextSource);

LdapTestUtils.cleanAndSetup (ldapTemplate.getContextSource (), new DistinguishedName (), new ClassPathResource ("nl/ipo/cds/dao/testdata.ldif"));

((ManagerDaoImpl)managerDao).setLdapTemplate (ldapTemplate);

      entityManager.flush ();
  }
 
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:23,代码来源:BaseLdapManagerDaoTest.java

示例9: init

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
public void init() throws Exception {
    if (!useLdapAuth()) {
        return;
    }
    LdapContextSource contextSource = new DefaultSpringSecurityContextSource(ldapHost);
    contextSource.setUserDn(ldapUsername);
    contextSource.setPassword(ldapPassword);
    contextSource.afterPropertiesSet();

    DefaultLdapAuthoritiesPopulator ldapAuthoritiesPopulator =
            new DefaultLdapAuthoritiesPopulator(contextSource, ldapGroupSearchBase);
    ldapAuthoritiesPopulator.setGroupRoleAttribute(ldapGroupRoleAttribute);
    ldapAuthoritiesPopulator.setGroupSearchFilter(ldapGroupSearchFilter);

    ldapBindAuthenticator = new SimpleBindAunthenticator(contextSource, gizmoGroup);
    ldapBindAuthenticator.setUserDnPatterns(new String[]{userDnPattern});
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:18,代码来源:GizmoAuthProvider.java

示例10: ldapTemplate

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
public static LdapTemplate ldapTemplate(String bindDn, String password, int port) {
	LdapTemplate t = new LdapTemplate();
	LdapContextSource s = new LdapContextSource();
	s.setPassword(password);
	s.setUserDn(bindDn);
	s.setUrl(String.format("ldap://localhost:%d", port));
	t.setContextSource(s);

	try {
		t.afterPropertiesSet();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	s.afterPropertiesSet();
	return t;
}
 
开发者ID:trevershick,项目名称:ldap-test-utils,代码行数:17,代码来源:Utils.java

示例11: getUserLdapRepository

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
/**
 * Build a user LDAP repository from the given node.
 * 
 * @param node
 *            The node, also used as cache key.
 * @return The {@link UserLdapRepository} instance. Cache is involved.
 */
@CacheResult(cacheName = "ldap-user-repository")
public UserLdapRepository getUserLdapRepository(@CacheKey final String node) {
	log.info("Build ldap template for node {}", node);
	final Map<String, String> parameters = pvResource.getNodeParameters(node);
	final LdapContextSource contextSource = new LdapContextSource();
	contextSource.setReferral(parameters.get(PARAMETER_REFERRAL));
	contextSource.setPassword(parameters.get(PARAMETER_PASSWORD));
	contextSource.setUrl(parameters.get(PARAMETER_URL));
	contextSource.setUserDn(parameters.get(PARAMETER_USER));
	contextSource.setBase(parameters.get(PARAMETER_BASE_BN));
	contextSource.afterPropertiesSet();
	final LdapTemplate template = new LdapTemplate();
	template.setContextSource(contextSource);
	template.setIgnorePartialResultException(true);

	// A new repository instance
	final UserLdapRepository repository = new UserLdapRepository();
	repository.setTemplate(template);
	repository.setPeopleBaseDn(StringUtils.trimToEmpty(parameters.get(PARAMETER_PEOPLE_DN)));
	repository.setPeopleInternalBaseDn(parameters.get(PARAMETER_PEOPLE_INTERNAL_DN));
	repository.setQuarantineBaseDn(StringUtils.trimToEmpty(parameters.get(PARAMETER_QUARANTINE_DN)));
	repository.setDepartmentAttribute(parameters.get(PARAMETER_DEPARTMENT_ATTRIBUTE));
	repository.setLocalIdAttribute(parameters.get(PARAMETER_LOCAL_ID_ATTRIBUTE));
	repository.setUidAttribute(parameters.get(PARAMETER_UID_ATTRIBUTE));
	repository.setLockedAttribute(parameters.get(PARAMETER_LOCKED_ATTRIBUTE));
	repository.setLockedValue(parameters.get(PARAMETER_LOCKED_VALUE));
	repository.setPeopleClass(parameters.get(PARAMETER_PEOPLE_CLASS));
	repository.setCompanyPattern(StringUtils.trimToEmpty(parameters.get(PARAMETER_COMPANY_PATTERN)));

	// Complete the bean
	SpringUtils.getApplicationContext().getAutowireCapableBeanFactory().autowireBean(repository);

	return repository;
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:42,代码来源:LdapPluginResource.java

示例12: contextSourceLdap

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
/**
 * LdapContextSource
 * @return le context ldap
 */
@Bean
public LdapContextSource contextSourceLdap() {
	LdapContextSource ldapContextSource = new LdapContextSource();
	ldapContextSource.setUrl(ldapUrl);
	ldapContextSource.setBase(ldapBase);
	ldapContextSource.setUserDn(ldapUser);
	ldapContextSource.setPassword(ldapPwd);
	return ldapContextSource;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:14,代码来源:LdapConfig.java

示例13: getLdapContextSource

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
private LdapContextSource getLdapContextSource() throws Exception {
    LdapContextSource cs = new LdapContextSource();
    cs.setUrl(Config.getLdapUrl());
    cs.setBase(Config.getLDAPBase());
    cs.setUserDn(Config.getUserDN());
    //cs.setAnonymousReadOnly(true);
    Hashtable<String, Object> env = new Hashtable<String, Object>();
    env.put(Context.REFERRAL, "follow");
    cs.setBaseEnvironmentProperties(env);
    cs.setPassword(Config.getLdapPassword());       
    cs.afterPropertiesSet();
    
    return cs;
}
 
开发者ID:AuScope,项目名称:igsn30,代码行数:15,代码来源:MultiHttpSecurityConfig.java

示例14: createLdapContextSource

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
protected LdapContextSource createLdapContextSource(RestLdapConfig ldapConfig) {
    LdapContextSource ldapContextSource = new LdapContextSource();

    ldapContextSource.setBase(ldapConfig.getLdapBase());
    List<String> ldapUrls = ldapConfig.getLdapUrls();
    ldapContextSource.setUrls(ldapUrls.toArray(new String[ldapUrls.size()]));
    ldapContextSource.setUserDn(ldapConfig.getLdapUser());
    ldapContextSource.setPassword(ldapConfig.getLdapPassword());

    ldapContextSource.afterPropertiesSet();

    return ldapContextSource;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:LdapAuthController.java

示例15: getLdapContextSource

import org.springframework.ldap.core.support.LdapContextSource; //导入方法依赖的package包/类
private LdapContextSource getLdapContextSource() throws Exception {
    LdapContextSource ldapContextSource = new DefaultSpringSecurityContextSource(
            ldapURL);
    ldapContextSource.setUserDn(ldapBindDN);
    ldapContextSource.setPassword(ldapBindPassword);
    ldapContextSource.setReferral(ldapReferral);
    ldapContextSource.setCacheEnvironmentProperties(false);
    ldapContextSource.setAnonymousReadOnly(false);
    ldapContextSource.setPooled(true);
    ldapContextSource.afterPropertiesSet();
    return ldapContextSource;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:13,代码来源:AtlasLdapAuthenticationProvider.java


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