directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1042325 - in /directory/apacheds/branches/apacheds-kerberos-codec-2.0: kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/ protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ protocol-k...
Date Sun, 05 Dec 2010 11:57:11 GMT
Author: kayyagari
Date: Sun Dec  5 11:57:11 2010
New Revision: 1042325

URL: http://svn.apache.org/viewvc?rev=1042325&view=rev
Log:
o replaced AuthenticationReply with AsRep and fixed AuthenticationService

Removed:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/AuthenticationReply.java
Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcContext.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/AuthenticationEncryptionTypeTest.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcContext.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/KdcContext.java?rev=1042325&r1=1042324&r2=1042325&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcContext.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcContext.java
Sun Dec  5 11:57:11 2010
@@ -23,10 +23,10 @@ package org.apache.directory.server.kerb
 import java.net.InetAddress;
 
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
-import org.apache.directory.server.kerberos.shared.messages.KerberosMessage;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
 import org.apache.directory.shared.kerberos.components.KdcReq;
+import org.apache.directory.shared.kerberos.messages.KerberosMessage;
 
 
 /**

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=1042325&r1=1042324&r2=1042325&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
Sun Dec  5 11:57:11 2010
@@ -40,7 +40,6 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.RandomKeyFactory;
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
-import org.apache.directory.server.kerberos.shared.messages.AuthenticationReply;
 import org.apache.directory.server.kerberos.shared.messages.KdcReply;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
@@ -52,6 +51,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.kerberos.codec.types.PaDataType;
 import org.apache.directory.shared.kerberos.components.ETypeInfo;
 import org.apache.directory.shared.kerberos.components.ETypeInfoEntry;
+import org.apache.directory.shared.kerberos.components.EncKdcRepPart;
 import org.apache.directory.shared.kerberos.components.EncTicketPart;
 import org.apache.directory.shared.kerberos.components.EncryptedData;
 import org.apache.directory.shared.kerberos.components.EncryptionKey;
@@ -66,6 +66,8 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.kerberos.exceptions.InvalidTicketException;
 import org.apache.directory.shared.kerberos.flags.TicketFlag;
 import org.apache.directory.shared.kerberos.flags.TicketFlags;
+import org.apache.directory.shared.kerberos.messages.AsRep;
+import org.apache.directory.shared.kerberos.messages.EncAsRepPart;
 import org.apache.directory.shared.kerberos.messages.Ticket;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -112,14 +114,6 @@ public class AuthenticationService
         getServerEntry( authContext );
         generateTicket( authContext );
         buildReply( authContext );
-
-        if ( LOG.isDebugEnabled() )
-        {
-            monitorContext( authContext );
-            monitorReply( ( KdcContext ) authContext );
-        }
-        
-        sealReply( authContext );
     }
 
     
@@ -322,7 +316,8 @@ public class AuthenticationService
         PrincipalName principal = authContext.getRequest().getKdcReqBody().getSName();
         PrincipalStore store = authContext.getStore();
     
-        authContext.setServerEntry( getEntry( principal, store, ErrorType.KDC_ERR_S_PRINCIPAL_UNKNOWN
) );
+        KerberosPrincipal principalWithRealm = new KerberosPrincipal( principal.getNameString()
+ "@" + authContext.getRequest().getKdcReqBody().getRealm() );
+        authContext.setServerEntry( getEntry( principalWithRealm, store, ErrorType.KDC_ERR_S_PRINCIPAL_UNKNOWN
) );
     }    
     
     
@@ -554,43 +549,47 @@ public class AuthenticationService
         KdcReq request = authContext.getRequest();
         Ticket ticket = authContext.getTicket();
 
-        AuthenticationReply reply = new AuthenticationReply();
-
-        reply.setClientPrincipal( request.getKdcReqBody().getCName() );
+        AsRep reply = new AsRep();
+        
+        reply.setCName( request.getKdcReqBody().getCName() );
         reply.setTicket( ticket );
-        reply.setKey( ticket.getEncTicketPart().getKey() );
+        
+        EncKdcRepPart encKdcRepPart = new EncKdcRepPart();
+        encKdcRepPart.setKey( ticket.getEncTicketPart().getKey() );
 
         // TODO - fetch lastReq for this client; requires store
-        reply.setLastReq( new LastReq() );
+        encKdcRepPart.setLastReq( new LastReq() );
         // TODO - resp.key-expiration := client.expiration; requires store
 
-        reply.setNonce( request.getKdcReqBody().getNonce() );
+        encKdcRepPart.setNonce( request.getKdcReqBody().getNonce() );
 
-        reply.setFlags( ticket.getEncTicketPart().getFlags() );
-        reply.setAuthTime( ticket.getEncTicketPart().getAuthTime() );
-        reply.setStartTime( ticket.getEncTicketPart().getStartTime() );
-        reply.setEndTime( ticket.getEncTicketPart().getEndTime() );
+        encKdcRepPart.setFlags( ticket.getEncTicketPart().getFlags() );
+        encKdcRepPart.setAuthTime( ticket.getEncTicketPart().getAuthTime() );
+        encKdcRepPart.setStartTime( ticket.getEncTicketPart().getStartTime() );
+        encKdcRepPart.setEndTime( ticket.getEncTicketPart().getEndTime() );
 
         if ( ticket.getEncTicketPart().getFlags().isRenewable() )
         {
-            reply.setRenewTill( ticket.getEncTicketPart().getRenewTill() );
+            encKdcRepPart.setRenewTill( ticket.getEncTicketPart().getRenewTill() );
         }
 
-        reply.setServerPrincipal( ticket.getServerPrincipal() );
-        reply.setClientAddresses( ticket.getEncTicketPart().getClientAddresses() );
+        encKdcRepPart.setSName( ticket.getSName() );
+        encKdcRepPart.setClientAddresses( ticket.getEncTicketPart().getClientAddresses()
);
 
-        authContext.setReply( reply );
-    }
-    
-    
-    private static void sealReply( AuthenticationContext authContext ) throws KerberosException,
InvalidTicketException
-    {
-        AuthenticationReply reply = ( AuthenticationReply ) authContext.getReply();
-        EncryptionKey clientKey = authContext.getClientKey();
-        CipherTextHandler cipherTextHandler = authContext.getCipherTextHandler();
+        EncAsRepPart encAsRepPart = new EncAsRepPart();
+        encAsRepPart.setEncKdcRepPart( encKdcRepPart );
 
-        EncryptedData encryptedData = cipherTextHandler.seal( clientKey, reply, KeyUsage.NUMBER3
);
+        if ( LOG.isDebugEnabled() )
+        {
+            monitorContext( authContext );
+            monitorReply( ( KdcContext ) authContext );
+        }
+        
+        EncryptionKey clientKey = authContext.getClientKey();
+        EncryptedData encryptedData = cipherTextHandler.seal( clientKey, encAsRepPart, KeyUsage.NUMBER3
);
         reply.setEncPart( encryptedData );
+        
+        authContext.setReply( reply );
     }
     
     
@@ -645,7 +644,7 @@ public class AuthenticationService
             sb.append( "\n\t" + "clockSkew              " + clockSkew );
             sb.append( "\n\t" + "clientAddress          " + clientAddress );
 
-            PrincipalName clientPrincipal = authContext.getClientEntry().getPrincipal();
+            KerberosPrincipal clientPrincipal = authContext.getClientEntry().getPrincipal();
             PrincipalStoreEntry clientEntry = authContext.getClientEntry();
 
             sb.append( "\n\t" + "principal              " + clientPrincipal );
@@ -654,7 +653,7 @@ public class AuthenticationService
             sb.append( "\n\t" + "principal              " + clientEntry.getPrincipal() );
             sb.append( "\n\t" + "SAM type               " + clientEntry.getSamType() );
 
-            PrincipalName serverPrincipal = authContext.getRequest().getServerPrincipal();
+            PrincipalName serverPrincipal = authContext.getRequest().getKdcReqBody().getSName();
             PrincipalStoreEntry serverEntry = authContext.getServerEntry();
 
             sb.append( "\n\t" + "principal              " + serverPrincipal );

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.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/AuthenticationEncryptionTypeTest.java?rev=1042325&r1=1042324&r2=1042325&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
Sun Dec  5 11:57:11 2010
@@ -34,7 +34,7 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KerberosKeyFactory;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
-import org.apache.directory.server.kerberos.shared.messages.AuthenticationReply;
+import org.apache.directory.shared.kerberos.messages.AsRep;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.options.KdcOptions;

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.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/AuthenticationServiceTest.java?rev=1042325&r1=1042324&r2=1042325&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
Sun Dec  5 11:57:11 2010
@@ -31,7 +31,7 @@ import javax.security.auth.kerberos.Kerb
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
-import org.apache.directory.server.kerberos.shared.messages.AuthenticationReply;
+import org.apache.directory.shared.kerberos.messages.AsRep;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.options.KdcOptions;



Mime
View raw message