summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/AgentPath.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2013-02-22 14:04:33 +0100
committerAndrew Branson <andrew.branson@cern.ch>2013-03-18 14:03:54 +0100
commit6e35118970c7af70eb0ac938859d794f7348d367 (patch)
treec85299f5a174a04c9df2847c1f469ff427dd6f64 /src/main/java/com/c2kernel/lookup/AgentPath.java
parentd6cfc7505be13b3b09adf423206cf75d9f806c12 (diff)
Extracted LDAP specifics into subpackage
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/AgentPath.java')
-rw-r--r--src/main/java/com/c2kernel/lookup/AgentPath.java36
1 files changed, 3 insertions, 33 deletions
diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java
index 8c83251..c200d75 100644
--- a/src/main/java/com/c2kernel/lookup/AgentPath.java
+++ b/src/main/java/com/c2kernel/lookup/AgentPath.java
@@ -15,11 +15,9 @@ import java.security.NoSuchAlgorithmException;
import org.apache.xerces.impl.dv.util.Base64;
-import com.c2kernel.common.ObjectCannotBeUpdated;
import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.lookup.ldap.LDAPLookupUtils;
import com.c2kernel.process.Gateway;
-import com.novell.ldap.LDAPAttribute;
-import com.novell.ldap.LDAPAttributeSet;
import com.novell.ldap.LDAPEntry;
@@ -32,8 +30,8 @@ import com.novell.ldap.LDAPEntry;
public class AgentPath extends EntityPath
{
- private String mAgentName=null;
- private String mPassword=null;
+ protected String mAgentName=null;
+ protected String mPassword=null;
public AgentPath(int syskey, String agentName)
throws InvalidAgentPathException,InvalidEntityPathException
@@ -122,33 +120,5 @@ public class AgentPath extends EntityPath
digest.append(Base64.encode(hash));
return digest.toString();
}
-
- @Override
- public LDAPAttributeSet createAttributeSet() throws ObjectCannotBeUpdated
- {
- LDAPAttributeSet attrs = new LDAPAttributeSet();
- attrs.add(new LDAPAttribute("objectclass","cristalagent"));
- attrs.add(new LDAPAttribute("intsyskey",Integer.toString(mSysKey)));
- attrs.add(new LDAPAttribute("cn", getPath()[getPath().length-1]));
- if (mIOR != null)
- attrs.add(new LDAPAttribute("ior", Gateway.getORB().object_to_string(mIOR)));
-
- if (mAgentName!=null && mAgentName.length()>0)
- attrs.add(new LDAPAttribute("uid",mAgentName));
- else
- throw new ObjectCannotBeUpdated("Cannot create agent. No userId specified", "");
-
- if (mPassword!=null && mPassword.length()>0)
- try {
- attrs.add(new LDAPAttribute("userPassword",generateUserPassword(mPassword, "SHA")));
- } catch (NoSuchAlgorithmException ex) {
- throw new ObjectCannotBeUpdated("Cryptographic libraries for password hashing not found.", "");
- }
- else
- throw new ObjectCannotBeUpdated("Cannot create agent. No password given", "");
-
- return attrs;
- }
-
}