12-02-2015 08:00 AM
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl process = new org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration();
process.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
process.setJdbcDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
process.setJdbcUrl("jdbc:sqlserver://"+jdbcHost+";databaseName="+jdbcDatabase);
process.setJdbcUsername(jdbcUser);
process.setJdbcPassword(jdbcPass);
process.setAsyncExecutorEnabled(true);
process.setAsyncExecutorActivate(false);
LDAPConfigurator ldapConfig = new LDAPConfigurator();
//LDAP connection params
ldapConfig.setServer(ldapUrl);
ldapConfig.setPort(lPort);
ldapConfig.setUser(ldapUser);
ldapConfig.setPassword(ldapPass);
ldapConfig.setSecurityAuthentication("simple");
ldapConfig.setInitialContextFactory("com.sun.jndi.ldap.LdapCtxFactory");
ldapConfig.setBaseDn(baseDn);
//Attributes config
ldapConfig.setUserIdAttribute("sAMAccountName");
ldapConfig.setUserFirstNameAttribute("givenName");
ldapConfig.setUserLastNameAttribute("sn");
ldapConfig.setUserEmailAttribute("mail");
ldapConfig.setGroupIdAttribute("cn");
ldapConfig.setGroupNameAttribute("cn");
//Queries
ldapConfig.setQueryUserByUserId("(&(objectClass=user)(sAMAccountName={0}))");
ldapConfig.setQueryGroupsForUser("(&(objectClass=group)(member={0}))");
process.addConfigurator(ldapConfig);
org.activiti.engine.ProcessEngine engine = process.buildProcessEngine();
org.activiti.engine.identity.User user = engine.getIdentityService().createUserQuery().userId(ldapExistingUser).singleResult();
if(user == null){
System.err.println("User not found");
}else{
System.out.println(u.getId());
System.out.println(u.getFirstName());
System.out.println(u.getLastName());
System.out.println(u.getEmail());
}
[AWT-EventQueue-0] INFO org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - Found 1 Process Engine Configurators in total:
[AWT-EventQueue-0] INFO org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - class org.activiti.ldap.LDAPConfigurator (priority:10000)
[AWT-EventQueue-0] INFO org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - Executing beforeInit() of class org.activiti.ldap.LDAPConfigurator (priority:10000)
[AWT-EventQueue-0] INFO org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - Executing configure() of class org.activiti.ldap.LDAPConfigurator (priority:10000)
[AWT-EventQueue-0] INFO org.activiti.engine.impl.ProcessEngineImpl - ProcessEngine default created
User not found
12-02-2015 08:15 AM
12-04-2015 06:52 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.