directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1041449 - in /directory/apacheds/branches/apacheds-kerberos-codec-2.0: kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages...
Date Thu, 02 Dec 2010 16:52:01 GMT
Author: elecharny
Date: Thu Dec  2 16:52:01 2010
New Revision: 1041449

URL: http://svn.apache.org/viewvc?rev=1041449&view=rev
Log:
Removed the AuthenticatorModifier class.
Some other fixes

Removed:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/AuthenticatorModifier.java
Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordService.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java?rev=1041449&r1=1041448&r2=1041449&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java
Thu Dec  2 16:52:01 2010
@@ -24,8 +24,6 @@ import java.io.IOException;
 import java.util.Enumeration;
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
-import org.apache.directory.shared.kerberos.messages.Authenticator;
-import org.apache.directory.server.kerberos.shared.messages.components.AuthenticatorModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DEREncodable;
@@ -34,6 +32,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.der.DERInteger;
 import org.apache.directory.shared.asn1.der.DERSequence;
 import org.apache.directory.shared.asn1.der.DERTaggedObject;
+import org.apache.directory.shared.kerberos.messages.Authenticator;
 
 
 /**
@@ -77,7 +76,7 @@ public class AuthenticatorDecoder implem
      */
     protected static Authenticator decode( DERSequence sequence )
     {
-        AuthenticatorModifier modifier = new AuthenticatorModifier();
+        Authenticator authenticator = new Authenticator();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -89,43 +88,43 @@ public class AuthenticatorDecoder implem
             {
                 case 0:
                     DERInteger tag0 = ( DERInteger ) derObject;
-                    modifier.setVersionNumber( tag0.intValue() );
+                    authenticator.setVersionNumber( tag0.intValue() );
                     break;
                 case 1:
                     DERGeneralString tag1 = ( DERGeneralString ) derObject;
-                    modifier.setClientRealm( tag1.getString() );
+                    authenticator.setCRealm( tag1.getString() );
                     break;
                 case 2:
                     DERSequence tag2 = ( DERSequence ) derObject;
-                    modifier.setClientName( PrincipalNameDecoder.decode( tag2 ) );
+                    authenticator.setCName( PrincipalNameDecoder.decode( tag2 ) );
                     break;
                 case 3:
                     DERSequence tag3 = ( DERSequence ) derObject;
-                    modifier.setChecksum( ChecksumDecoder.decode( tag3 ) );
+                    authenticator.setCksum( ChecksumDecoder.decode( tag3 ) );
                     break;
                 case 4:
                     DERInteger tag4 = ( DERInteger ) derObject;
-                    modifier.setClientMicroSecond( tag4.intValue() );
+                    authenticator.setCusec( tag4.intValue() );
                     break;
                 case 5:
                     DERGeneralizedTime tag5 = ( DERGeneralizedTime ) derObject;
-                    modifier.setClientTime( KerberosTimeDecoder.decode( tag5 ) );
+                    authenticator.setCTime( KerberosTimeDecoder.decode( tag5 ) );
                     break;
                 case 6:
                     DERSequence tag6 = ( DERSequence ) derObject;
-                    modifier.setSubSessionKey( EncryptionKeyDecoder.decode( tag6 ) );
+                    authenticator.setSubKey( EncryptionKeyDecoder.decode( tag6 ) );
                     break;
                 case 7:
                     DERInteger tag7 = ( DERInteger ) derObject;
-                    modifier.setSequenceNumber( tag7.intValue() );
+                    authenticator.setSeqNumber( tag7.intValue() );
                     break;
                 case 8:
                     DERSequence tag8 = ( DERSequence ) derObject;
-                    modifier.setAuthorizationData( AuthorizationDataDecoder.decodeSequence(
tag8 ) );
+                    authenticator.setAuthorizationData( AuthorizationDataDecoder.decodeSequence(
tag8 ) );
                     break;
             }
         }
 
-        return modifier.getAuthenticator();
+        return authenticator;
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordService.java?rev=1041449&r1=1041448&r2=1041449&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordService.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordService.java
Thu Dec  2 16:52:01 2010
@@ -107,7 +107,9 @@ public class ChangePasswordService
         PrincipalStore store = changepwContext.getStore();
         Authenticator authenticator = changepwContext.getAuthenticator();
         String newPassword = changepwContext.getPassword();
-        KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
+        KerberosPrincipal clientPrincipal = KerberosUtils.getKerberosPrincipal( 
+            authenticator.getCName(),
+            authenticator.getCRealm() );
 
         // usec and seq-number must be present per MS but aren't in legacy kpasswd
         // seq-number must have same value as authenticator
@@ -298,7 +300,8 @@ public class ChangePasswordService
             long clockSkew = changepwContext.getConfig().getAllowableClockSkew();
 
             Authenticator authenticator = changepwContext.getAuthenticator();
-            KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
+            KerberosPrincipal clientPrincipal = KerberosUtils.getKerberosPrincipal( 
+                authenticator.getCName(), authenticator.getCRealm() );
             String desiredPassword = changepwContext.getPassword();
 
             InetAddress clientAddress = changepwContext.getClientAddress();

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java?rev=1041449&r1=1041448&r2=1041449&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
Thu Dec  2 16:52:01 2010
@@ -28,6 +28,7 @@ import javax.security.auth.kerberos.Kerb
 import org.apache.directory.server.changepw.ChangePasswordServer;
 import org.apache.directory.server.changepw.exceptions.ChangePasswordException;
 import org.apache.directory.server.changepw.exceptions.ErrorType;
+import org.apache.directory.shared.kerberos.KerberosUtils;
 import org.apache.directory.shared.kerberos.messages.Authenticator;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.handler.chain.IoHandlerCommand;
@@ -54,7 +55,8 @@ public class CheckPasswordPolicy impleme
 
         ChangePasswordServer config = changepwContext.getConfig();
         Authenticator authenticator = changepwContext.getAuthenticator();
-        KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
+        KerberosPrincipal clientPrincipal = KerberosUtils.getKerberosPrincipal( 
+            authenticator.getCName(), authenticator.getCRealm() );
 
         String password = changepwContext.getPassword();
         String username = clientPrincipal.getName();

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java?rev=1041449&r1=1041448&r2=1041449&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java
Thu Dec  2 16:52:01 2010
@@ -46,12 +46,10 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
 import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
 import org.apache.directory.server.kerberos.shared.messages.application.PrivateMessage;
-import org.apache.directory.server.kerberos.shared.messages.components.AuthenticatorModifier;
 import org.apache.directory.server.kerberos.shared.messages.components.EncKrbPrivPart;
 import org.apache.directory.server.kerberos.shared.messages.components.EncKrbPrivPartModifier;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
 import org.apache.directory.server.kerberos.shared.messages.value.ApOptions;
-import org.apache.directory.shared.kerberos.components.EncryptedData;
 import org.apache.directory.shared.kerberos.components.HostAddress;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.server.kerberos.shared.store.TicketFactory;
@@ -59,8 +57,10 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
 import org.apache.directory.shared.kerberos.codec.types.PrincipalNameType;
+import org.apache.directory.shared.kerberos.components.EncryptedData;
 import org.apache.directory.shared.kerberos.components.EncryptionKey;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
+import org.apache.directory.shared.kerberos.messages.Authenticator;
 import org.apache.mina.core.future.WriteFuture;
 import org.apache.mina.core.session.DummySession;
 import org.junit.BeforeClass;
@@ -162,17 +162,17 @@ public class ChangepwProtocolHandlerTest
 
         ApOptions apOptions = new ApOptions();
 
-        AuthenticatorModifier modifier = new AuthenticatorModifier();
-        modifier.setVersionNumber( 5 );
-        modifier.setClientRealm( "EXAMPLE.COM" );
-        modifier.setClientName( getPrincipalName( "hnelson" ) );
-        modifier.setClientTime( new KerberosTime() );
-        modifier.setClientMicroSecond( 0 );
+        Authenticator authenticator = new Authenticator();
+        authenticator.setVersionNumber( 5 );
+        authenticator.setCRealm( "EXAMPLE.COM" );
+        authenticator.setCName( getPrincipalName( "hnelson" ) );
+        authenticator.setCTime( new KerberosTime() );
+        authenticator.setCusec( 0 );
 
-        modifier.setSubSessionKey( subSessionKey );
+        authenticator.setSubKey( subSessionKey );
 
-        EncryptedData encryptedAuthenticator = cipherTextHandler.seal( serviceTicket.getEncTicketPart().getSessionKey(),
modifier
-                .getAuthenticator(), KeyUsage.NUMBER11 );
+        EncryptedData encryptedAuthenticator = cipherTextHandler.seal( serviceTicket.getEncTicketPart().getSessionKey(),
authenticator
+                , KeyUsage.NUMBER11 );
 
         ApplicationRequest apReq = new ApplicationRequest( apOptions, serviceTicket, encryptedAuthenticator
);
 
@@ -240,14 +240,14 @@ public class ChangepwProtocolHandlerTest
 
         ApOptions apOptions = new ApOptions();
 
-        AuthenticatorModifier modifier = new AuthenticatorModifier();
-        modifier.setVersionNumber( 5 );
-        modifier.setClientRealm( "EXAMPLE.COM" );
-        modifier.setClientName( getPrincipalName( "hnelson" ) );
-        modifier.setClientTime( new KerberosTime() );
-        modifier.setClientMicroSecond( 0 );
+        Authenticator authenticator = new Authenticator();
+        authenticator.setVersionNumber( 5 );
+        authenticator.setCRealm( "EXAMPLE.COM" );
+        authenticator.setCName( getPrincipalName( "hnelson" ) );
+        authenticator.setCTime( new KerberosTime() );
+        authenticator.setCusec( 0 );
 
-        EncryptedData encryptedAuthenticator = cipherTextHandler.seal( serverKey, modifier.getAuthenticator(),
+        EncryptedData encryptedAuthenticator = cipherTextHandler.seal( serverKey, authenticator,
                 KeyUsage.NUMBER11 );
 
         ApplicationRequest apReq = new ApplicationRequest( apOptions, serviceTicket, encryptedAuthenticator
);

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java?rev=1041449&r1=1041448&r2=1041449&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java
Thu Dec  2 16:52:01 2010
@@ -408,7 +408,7 @@ public class AuthenticationService
         EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( authContext.getEncryptionType()
);
         newTicketBody.setSessionKey( sessionKey );
 
-        newTicketBody.setClientPrincipal( request.getClientPrincipal() );
+        newTicketBody.setcName( request.getKdcReqBody().getCName() );
         newTicketBody.setTransitedEncoding( new TransitedEncoding() );
 
         KerberosTime now = new KerberosTime();
@@ -573,7 +573,7 @@ public class AuthenticationService
 
         AuthenticationReply reply = new AuthenticationReply();
 
-        reply.setClientPrincipal( request.getClientPrincipal() );
+        reply.setClientPrincipal( request.getKdcReqBody().getCName() );
         reply.setTicket( ticket );
         reply.setKey( ticket.getEncTicketPart().getSessionKey() );
 

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java?rev=1041449&r1=1041448&r2=1041449&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
Thu Dec  2 16:52:01 2010
@@ -36,7 +36,6 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.io.encoder.KdcRequestEncoder;
 import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
-import org.apache.directory.server.kerberos.shared.messages.components.AuthenticatorModifier;
 import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPart;
 import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPartModifier;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
@@ -234,21 +233,19 @@ public abstract class AbstractTicketGran
     protected EncryptedData getAuthenticator( KerberosPrincipal clientPrincipal, RequestBody
requestBody,
         ChecksumType checksumType ) throws IOException, KerberosException
     {
-        AuthenticatorModifier authenticatorModifier = new AuthenticatorModifier();
+        Authenticator authenticator = new Authenticator();
 
         clientMicroSeconds = random.nextInt();
 
-        authenticatorModifier.setVersionNumber( 5 );
-        authenticatorModifier.setClientPrincipal( clientPrincipal );
-        authenticatorModifier.setClientTime( now );
-        authenticatorModifier.setClientMicroSecond( clientMicroSeconds );
-        authenticatorModifier.setSubSessionKey( subSessionKey );
-        authenticatorModifier.setSequenceNumber( sequenceNumber );
+        authenticator.setVersionNumber( 5 );
+        authenticator.setCName( new PrincipalName( clientPrincipal.getName(), clientPrincipal.getNameType()
) );
+        authenticator.setCTime( now );
+        authenticator.setCusec( clientMicroSeconds );
+        authenticator.setSubKey( subSessionKey );
+        authenticator.setSeqNumber( sequenceNumber );
 
         Checksum checksum = getBodyChecksum( requestBody, checksumType );
-        authenticatorModifier.setChecksum( checksum );
-
-        Authenticator authenticator = authenticatorModifier.getAuthenticator();
+        authenticator.setCksum( checksum );
 
         EncryptedData encryptedAuthenticator = lockBox.seal( sessionKey, authenticator, KeyUsage.NUMBER7
);
 



Mime
View raw message