use of com.tremolosecurity.provisioning.util.ldap.pool.LdapConnection in project OpenUnison by TremoloSecurity.
the class ADProvider method deleteGroup.
@Override
public void deleteGroup(String name, User user, Map<String, Object> request) throws ProvisioningException {
int approvalID = 0;
if (request.containsKey("APPROVAL_ID")) {
approvalID = (Integer) request.get("APPROVAL_ID");
}
Workflow workflow = (Workflow) request.get("WORKFLOW");
try {
LdapConnection con;
try {
con = this.ldapPool.getConnection();
} catch (Exception e) {
throw new ProvisioningException("Could not get LDAP connection " + user.getUserID(), e);
}
try {
LDAPSearchResults res = con.getConnection().search(this.searchBase, 2, and(equal("objectClass", "group"), equal("cn", name)).toString(), new String[] { "1.1" }, false);
if (res.hasMore()) {
LDAPEntry entry = res.next();
con.getConnection().delete(entry.getDN());
this.cfgMgr.getProvisioningEngine().logAction(name, false, ActionType.Delete, approvalID, workflow, "domain-group", name);
}
} finally {
con.returnCon();
}
} catch (Exception e) {
throw new ProvisioningException("Could not set user's password", e);
}
}
use of com.tremolosecurity.provisioning.util.ldap.pool.LdapConnection in project OpenUnison by TremoloSecurity.
the class ADProvider method setUserPassword.
@Override
public void setUserPassword(User user, Map<String, Object> request) throws ProvisioningException {
StringBuffer filter = new StringBuffer();
filter.append("(").append(this.userIDAttribute).append("=").append(user.getUserID()).append(")");
try {
LdapConnection con;
try {
con = this.ldapPool.getConnection();
} catch (Exception e) {
StringBuffer b = new StringBuffer();
b.append("Could not get LDAP connection ").append(user.getUserID());
throw new ProvisioningException(b.toString(), e);
}
try {
doSetPassword(user, filter, con.getConnection(), request);
} finally {
con.returnCon();
}
} catch (Exception e) {
throw new ProvisioningException("Could not set user's password", e);
}
}
use of com.tremolosecurity.provisioning.util.ldap.pool.LdapConnection in project OpenUnison by TremoloSecurity.
the class LDAPProvider method syncUser.
@Override
public void syncUser(User user, boolean fromUserOnly, Set<String> attributes, Map<String, Object> request) throws ProvisioningException {
try {
StringBuffer filter = new StringBuffer();
filter.append("(").append(this.userIDAttribute).append("=").append(user.getUserID()).append(")");
LdapConnection con;
try {
con = this.ldapPool.getConnection();
} catch (Exception e) {
throw new ProvisioningException("Could not get LDAP connection " + user.getUserID(), e);
}
try {
doSync(user, fromUserOnly, attributes, filter, con.getConnection(), request);
} finally {
con.returnCon();
}
} catch (LDAPException e) {
throw new ProvisioningException("Could not sync user " + user.getUserID(), e);
}
}
Aggregations