From 6e35118970c7af70eb0ac938859d794f7348d367 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 22 Feb 2013 14:04:33 +0100 Subject: Extracted LDAP specifics into subpackage --- src/main/java/com/c2kernel/lookup/AgentPath.java | 36 ++---------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/AgentPath.java') 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; - } - } -- cgit v1.2.3