directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r589782 [2/2] - in /directory/apacheds/branches/bigbang/protocol-kerberos/src: main/java/org/apache/directory/server/kerberos/kdc/authentication/ main/java/org/apache/directory/server/kerberos/kdc/preauthentication/ main/java/org/apache/dir...
Date Mon, 29 Oct 2007 18:17:43 GMT
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java?rev=589782&r1=589781&r2=589782&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
Mon Oct 29 11:17:35 2007
@@ -23,12 +23,12 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.shared.KerberosMessageType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.messages.AuthenticationReply;
 import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
-import org.apache.directory.server.kerberos.shared.messages.MessageType;
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
 import org.apache.directory.server.kerberos.shared.messages.value.PaData;
@@ -81,7 +81,7 @@
         KerberosTime till = new KerberosTime();
         modifier.setTill( till );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -102,7 +102,7 @@
         modifier.setRealm( "EXAMPLE.COM" );
         modifier.setEType( config.getEncryptionTypes() );
 
-        KdcRequest message = new KdcRequest( 4, MessageType.KRB_AS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 4, KerberosMessageType.AS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -117,14 +117,14 @@
      */
     public void testIncorrectMessageDirection()
     {
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REP, null, null );
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REP, null, null );
 
         handler.messageReceived( session, message );
 
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "Incorrect message direction", 47, error.getErrorCode() );
 
-        message = new KdcRequest( 5, MessageType.KRB_TGS_REP, null, null );
+        message = new KdcRequest( 5, KerberosMessageType.TGS_REP, null, null );
 
         handler.messageReceived( session, message );
 
@@ -148,7 +148,7 @@
         modifier.setRealm( "EXAMPLE.COM" );
         modifier.setEType( config.getEncryptionTypes() );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -190,7 +190,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -217,7 +217,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -238,7 +238,7 @@
         modifier.setRealm( "EXAMPLE.COM" );
         modifier.setEType( config.getEncryptionTypes() );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -266,7 +266,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -307,7 +307,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -355,7 +355,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -403,7 +403,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -450,7 +450,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -492,7 +492,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -533,7 +533,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -586,7 +586,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -597,12 +597,12 @@
         assertTrue( "POSTDATED flag", reply.getFlags().get( TicketFlags.POSTDATED ) );
         assertTrue( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "Requested start time", requestedStartTime.equals( reply.getTicket().getStartTime()
) );
+        assertTrue( "Requested start time", requestedStartTime.equals( reply.getTicket().getEncTicketPart().getStartTime()
) );
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
-        assertTrue( "POSTDATED flag", reply.getTicket().getFlags().get( TicketFlags.POSTDATED
) );
-        assertTrue( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "POSTDATED flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.POSTDATED ) );
+        assertTrue( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
-        assertTrue( "PRE_AUTHENT flag", reply.getTicket().getFlags().get( TicketFlags.PRE_AUTHENT
) );
+        assertTrue( "PRE_AUTHENT flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.PRE_AUTHENT ) );
     }
 
 
@@ -636,7 +636,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -644,7 +644,7 @@
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
 
-        assertTrue( "PRE_AUTHENT flag", reply.getTicket().getFlags().get( TicketFlags.PRE_AUTHENT
) );
+        assertTrue( "PRE_AUTHENT flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.PRE_AUTHENT ) );
     }
 
 
@@ -679,7 +679,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -717,7 +717,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -756,7 +756,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -765,8 +765,8 @@
         assertTrue( "INITIAL flag", reply.getFlags().get( TicketFlags.INITIAL ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "INITIAL flag", reply.getTicket().getFlags().get( TicketFlags.INITIAL
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "INITIAL flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INITIAL ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
         assertEquals( "Service principal name", reply.getServerPrincipal().getName(), servicePrincipalName
);
         assertEquals( "Service principal name", reply.getTicket().getServerPrincipal().getName(),
servicePrincipalName );
@@ -808,7 +808,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -857,7 +857,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -866,8 +866,8 @@
         assertTrue( "FORWARDABLE flag", reply.getFlags().get( TicketFlags.FORWARDABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "FORWARDABLE flag", reply.getTicket().getFlags().get( TicketFlags.FORWARDABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "FORWARDABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.FORWARDABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -901,7 +901,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -910,8 +910,8 @@
         assertTrue( "MAY_POSTDATE flag", reply.getFlags().get( TicketFlags.MAY_POSTDATE )
);
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "MAY_POSTDATE flag", reply.getTicket().getFlags().get( TicketFlags.MAY_POSTDATE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "MAY_POSTDATE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.MAY_POSTDATE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -945,7 +945,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -954,8 +954,8 @@
         assertTrue( "PROXIABLE flag", reply.getFlags().get( TicketFlags.PROXIABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "PROXIABLE flag", reply.getTicket().getFlags().get( TicketFlags.PROXIABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "PROXIABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.PROXIABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -995,7 +995,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1004,8 +1004,8 @@
         assertTrue( "RENEWABLE flag", reply.getFlags().get( TicketFlags.RENEWABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "RENEWABLE flag", reply.getTicket().getFlags().get( TicketFlags.RENEWABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "RENEWABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.RENEWABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
         assertTrue( "Requested renew-till time", requestedRenewTillTime.equals( reply.getRenewTill()
) );
     }
@@ -1048,7 +1048,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1057,8 +1057,8 @@
         assertTrue( "RENEWABLE flag", reply.getFlags().get( TicketFlags.RENEWABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "RENEWABLE flag", reply.getTicket().getFlags().get( TicketFlags.RENEWABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "RENEWABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.RENEWABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
         KerberosTime expectedRenewTillTime = new KerberosTime( now + KerberosTime.WEEK );
         boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime()
) < 5000;
@@ -1093,7 +1093,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1129,7 +1129,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1165,7 +1165,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1201,7 +1201,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1237,7 +1237,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java?rev=589782&r1=589781&r2=589782&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
Mon Oct 29 11:17:35 2007
@@ -23,12 +23,12 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.shared.KerberosMessageType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
 import org.apache.directory.server.kerberos.shared.io.encoder.EncryptedDataEncoder;
 import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
-import org.apache.directory.server.kerberos.shared.messages.MessageType;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
@@ -86,7 +86,7 @@
         modifier.setRealm( "EXAMPLE.COM" );
         modifier.setEType( config.getEncryptionTypes() );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -126,7 +126,7 @@
         String passPhrase = "badpassword";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -163,7 +163,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase, timeStamp
);
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -198,7 +198,7 @@
         String passPhrase = "secret";
         PaData[] paData = getPreAuthPublicKey( clientPrincipal, passPhrase );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REQ, paData, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java?rev=589782&r1=589781&r2=589782&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
Mon Oct 29 11:17:35 2007
@@ -25,6 +25,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.shared.KerberosMessageType;
 import org.apache.directory.server.kerberos.shared.crypto.checksum.ChecksumType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
@@ -32,7 +33,6 @@
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
-import org.apache.directory.server.kerberos.shared.messages.MessageType;
 import org.apache.directory.server.kerberos.shared.messages.TicketGrantReply;
 import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPartModifier;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
@@ -138,7 +138,7 @@
         modifier.setRealm( "EXAMPLE.COM" );
         modifier.setEType( config.getEncryptionTypes() );
 
-        KdcRequest message = new KdcRequest( 4, MessageType.KRB_TGS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 4, KerberosMessageType.TGS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -219,13 +219,13 @@
         RequestBody requestBody = modifier.getRequestBody();
 
         // Get the session key from the service ticket.
-        sessionKey = tgt.getSessionKey();
+        sessionKey = tgt.getEncTicketPart().getSessionKey();
 
         // Generate a new sequence number.
         sequenceNumber = random.nextInt();
         now = new KerberosTime();
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_TGS_REQ, null, requestBody
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.TGS_REQ, null, requestBody
);
 
         handler.messageReceived( session, message );
 
@@ -430,7 +430,7 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        KerberosTime expectedRenewTillTime = tgt.getRenewTill();
+        KerberosTime expectedRenewTillTime = tgt.getEncTicketPart().getRenewTill();
         boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime()
) < 5000;
         assertTrue( "Expected renew till time", isClose );
     }
@@ -480,7 +480,7 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        KerberosTime expectedRenewTillTime = tgt.getRenewTill();
+        KerberosTime expectedRenewTillTime = tgt.getEncTicketPart().getRenewTill();
         boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime()
) < 5000;
         assertTrue( "Expected renew till time", isClose );
     }
@@ -537,10 +537,10 @@
         assertTrue( "PROXY flag", reply.getFlags().get( TicketFlags.PROXY ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "PROXY flag", reply.getTicket().getFlags().get( TicketFlags.PROXY ) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "PROXY flag", reply.getTicket().getEncTicketPart().getFlags().get( TicketFlags.PROXY
) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
-        assertNotNull( reply.getTicket().getClientAddresses() );
+        assertNotNull( reply.getTicket().getEncTicketPart().getClientAddresses() );
     }
 
 
@@ -595,10 +595,10 @@
         assertTrue( "FORWARDED flag", reply.getFlags().get( TicketFlags.FORWARDED ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "FORWARDED flag", reply.getTicket().getFlags().get( TicketFlags.FORWARDED
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "FORWARDED flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.FORWARDED ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
-        assertNotNull( reply.getTicket().getClientAddresses() );
+        assertNotNull( reply.getTicket().getEncTicketPart().getClientAddresses() );
     }
 
 
@@ -741,7 +741,7 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        KerberosTime expectedEndTime = tgt.getEndTime();
+        KerberosTime expectedEndTime = tgt.getEncTicketPart().getEndTime();
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime()
) < 5000;
         assertTrue( "Expected renew till time", isClose );
     }
@@ -825,7 +825,7 @@
         KerberosTime requestedEndTime = new KerberosTime( now + KerberosTime.DAY );
         modifier.setTill( requestedEndTime );
 
-        KdcRequest message = new KdcRequest( 5, MessageType.KRB_TGS_REQ, null, modifier.getRequestBody()
);
+        KdcRequest message = new KdcRequest( 5, KerberosMessageType.TGS_REQ, null, modifier.getRequestBody()
);
 
         handler.messageReceived( session, message );
 
@@ -1262,10 +1262,10 @@
         assertTrue( "POSTDATED flag", reply.getFlags().get( TicketFlags.POSTDATED ) );
         assertTrue( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "Requested start time", requestedStartTime.equals( reply.getTicket().getStartTime()
) );
+        assertTrue( "Requested start time", requestedStartTime.equals( reply.getTicket().getEncTicketPart().getStartTime()
) );
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
-        assertTrue( "POSTDATED flag", reply.getTicket().getFlags().get( TicketFlags.POSTDATED
) );
-        assertTrue( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "POSTDATED flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.POSTDATED ) );
+        assertTrue( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -1311,7 +1311,7 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertTrue( "PRE_AUTHENT flag", reply.getTicket().getFlags().get( TicketFlags.PRE_AUTHENT
) );
+        assertTrue( "PRE_AUTHENT flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.PRE_AUTHENT ) );
     }
 
 
@@ -1576,8 +1576,8 @@
         assertTrue( "FORWARDABLE flag", reply.getFlags().get( TicketFlags.FORWARDABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "FORWARDABLE flag", reply.getTicket().getFlags().get( TicketFlags.FORWARDABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "FORWARDABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.FORWARDABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -1630,8 +1630,8 @@
         assertTrue( "MAY_POSTDATE flag", reply.getFlags().get( TicketFlags.MAY_POSTDATE )
);
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "MAY_POSTDATE flag", reply.getTicket().getFlags().get( TicketFlags.MAY_POSTDATE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "MAY_POSTDATE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.MAY_POSTDATE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -1684,8 +1684,8 @@
         assertTrue( "PROXIABLE flag", reply.getFlags().get( TicketFlags.PROXIABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "PROXIABLE flag", reply.getTicket().getFlags().get( TicketFlags.PROXIABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "PROXIABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.PROXIABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 
@@ -1744,8 +1744,8 @@
         assertTrue( "RENEWABLE flag", reply.getFlags().get( TicketFlags.RENEWABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "RENEWABLE flag", reply.getTicket().getFlags().get( TicketFlags.RENEWABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "RENEWABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.RENEWABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
         assertTrue( "Requested renew-till time", requestedRenewTillTime.equals( reply.getRenewTill()
) );
     }
@@ -1807,8 +1807,8 @@
         assertTrue( "RENEWABLE flag", reply.getFlags().get( TicketFlags.RENEWABLE ) );
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
 
-        assertTrue( "RENEWABLE flag", reply.getTicket().getFlags().get( TicketFlags.RENEWABLE
) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertTrue( "RENEWABLE flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.RENEWABLE ) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
 
         KerberosTime expectedRenewTillTime = new KerberosTime( now + KerberosTime.WEEK );
         boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime()
) < 5000;
@@ -1861,7 +1861,7 @@
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
         assertFalse( "INVALID flag", reply.getFlags().get( TicketFlags.INVALID ) );
-        assertFalse( "INVALID flag", reply.getTicket().getFlags().get( TicketFlags.INVALID
) );
+        assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().get(
TicketFlags.INVALID ) );
     }
 
 



Mime
View raw message