directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckopp...@apache.org
Subject svn commit: r762529 - in /directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store: DirectoryPrincipalStore.java SingleBaseSearch.java operations/ChangePassword.java
Date Mon, 06 Apr 2009 22:18:31 GMT
Author: ckoppelt
Date: Mon Apr  6 22:18:31 2009
New Revision: 762529

URL: http://svn.apache.org/viewvc?rev=762529&view=rev
Log:
started work on Change Password service

Modified:
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/DirectoryPrincipalStore.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/DirectoryPrincipalStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/DirectoryPrincipalStore.java?rev=762529&r1=762528&r2=762529&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/DirectoryPrincipalStore.java
(original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/DirectoryPrincipalStore.java
Mon Apr  6 22:18:31 2009
@@ -23,7 +23,6 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -37,8 +36,8 @@
 public class DirectoryPrincipalStore implements PrincipalStore
 {
     /** The directory service backing store for this PrincipalStore. */
-    private DirectoryService directoryService;
-    private LdapDN searchBaseDn;
+    private final DirectoryService directoryService;
+    private final LdapDN searchBaseDn;
     
     
     /**
@@ -58,8 +57,8 @@
      */
     public String changePassword( KerberosPrincipal principal, String newPassword ) throws
Exception
     {
-        //TODO check if this method is still in use, otherwise remove it
-        throw new NotImplementedException();
+        SingleBaseSearch singleBaseSearch = new SingleBaseSearch( directoryService, searchBaseDn
);
+        return singleBaseSearch.changePassword( principal, newPassword );
     }
 
 

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java?rev=762529&r1=762528&r2=762529&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
(original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
Mon Apr  6 22:18:31 2009
@@ -66,6 +66,6 @@
 
     public String changePassword( KerberosPrincipal principal, String newPassword ) throws
Exception
     {
-        return ( String ) new ChangePassword( principal, newPassword ).execute( session,
null );
+        return (String) new ChangePassword( principal, newPassword ).execute( session, searchBaseDn
);
     }
 }

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java?rev=762529&r1=762528&r2=762529&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
(original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
Mon Apr  6 22:18:31 2009
@@ -31,12 +31,14 @@
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerModification;
+import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
 import org.apache.directory.server.protocol.shared.store.DirectoryServiceOperation;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -80,17 +82,18 @@
         List<Modification> mods = new ArrayList<Modification>(2);
         
         ServerAttribute newPasswordAttribute = new DefaultServerAttribute( 
-            registry.lookup( SchemaConstants.USER_PASSWORD_AT_OID ), newPassword );
-        mods.set( 0, new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, newPasswordAttribute
) );
+            registry.lookup( SchemaConstants.USER_PASSWORD_AT ), StringTools.getBytesUtf8(
newPassword ) );
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, newPasswordAttribute
) );
         
         ServerAttribute principalAttribute = new DefaultServerAttribute( 
-            registry.lookup( "krb5PrincipalName" ), principal.getName() );
-        mods.set( 1, new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, principalAttribute
) );
-
+            registry.lookup( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ), principal.getName()
);
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, principalAttribute
) );
+        
+        //FIXME check if keyderivation is necessary
         
         ServerEntry entry = StoreUtils.findPrincipalEntry( session, searchBaseDn, principal.getName()
);
         session.modify( entry.getDn(), mods );
 
-        return entry.getDn();
+        return entry.getDn().toString();
     }
 }



Mime
View raw message