diff options
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/LDAPRoleManager.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lookup/LDAPRoleManager.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java index b2cffc6..f40cd53 100644 --- a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java +++ b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java @@ -1,5 +1,6 @@ package com.c2kernel.lookup;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -207,5 +208,17 @@ public class LDAPRoleManager { // set attribute
LDAPLookupUtils.setAttributeValue(mLdap.getConnection(), roleEntry, "jobList", hasJobList?"TRUE":"FALSE");
}
+
+ public void setAgentPassword(AgentPath agent, String newPassword) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException {
+ String encPasswd = AgentPath.generateUserPassword(newPassword, "SHA");
+ LDAPEntry agentEntry;
+ try {
+ agentEntry = LDAPLookupUtils.getEntry(mLdap.getConnection(), agent.getFullDN());
+ } catch (ObjectNotFoundException e) {
+ throw new ObjectNotFoundException("Agent "+agent.getAgentName()+" does not exist", "");
+ }
+ LDAPLookupUtils.setAttributeValue(mLdap.getConnection(), agentEntry, "userPassword", encPasswd);
+
+ }
}
|
