directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1042725 - in /directory/apacheds/branches/apacheds-kerberos-codec-2.0: kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/ protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/
Date Mon, 06 Dec 2010 17:13:55 GMT
Author: kayyagari
Date: Mon Dec  6 17:13:54 2010
New Revision: 1042725

URL: http://svn.apache.org/viewvc?rev=1042725&view=rev
Log:
o fixed few compiler errors

Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/TicketFactory.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-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/TicketFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/TicketFactory.java?rev=1042725&r1=1042724&r2=1042725&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/TicketFactory.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/TicketFactory.java
Mon Dec  6 17:13:54 2010
@@ -22,6 +22,7 @@ package org.apache.directory.server.kerb
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.text.ParseException;
 import java.util.Date;
 
 import javax.security.auth.kerberos.KerberosKey;
@@ -31,13 +32,15 @@ import javax.security.auth.kerberos.Kerb
 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.crypto.encryption.RandomKeyFactory;
-import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPartModifier;
 import org.apache.directory.shared.kerberos.KerberosConstants;
 import org.apache.directory.shared.kerberos.KerberosTime;
+import org.apache.directory.shared.kerberos.KerberosUtils;
 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.EncTicketPart;
 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.components.TransitedEncoding;
 import org.apache.directory.shared.kerberos.exceptions.KerberosException;
 import org.apache.directory.shared.kerberos.flags.TicketFlag;
@@ -91,39 +94,36 @@ public class TicketFactory
      * @throws KerberosException
      */
     public Ticket getTicket( KerberosPrincipal clientPrincipal, KerberosPrincipal serverPrincipal,
-        EncryptionKey serverKey ) throws KerberosException
+        EncryptionKey serverKey ) throws KerberosException, ParseException
     {
-        EncTicketPartModifier encTicketModifier = new EncTicketPartModifier();
+        EncTicketPart encTicketPart = new EncTicketPart();
 
         TicketFlags ticketFlags = new TicketFlags();
         ticketFlags.setFlag( TicketFlag.RENEWABLE );
-        encTicketModifier.setFlags( ticketFlags );
+        encTicketPart.setFlags( ticketFlags );
 
         EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( EncryptionType.DES_CBC_MD5
);
 
-        encTicketModifier.setSessionKey( sessionKey );
-        encTicketModifier.setClientPrincipal( clientPrincipal );
-        encTicketModifier.setTransitedEncoding( new TransitedEncoding() );
-        encTicketModifier.setAuthTime( new KerberosTime() );
+        encTicketPart.setKey( sessionKey );
+        encTicketPart.setCName( new PrincipalName( clientPrincipal.getName(), PrincipalNameType.KRB_NT_PRINCIPAL
) );
+        encTicketPart.setTransited( new TransitedEncoding() );
+        encTicketPart.setAuthTime( new KerberosTime() );
 
         long now = System.currentTimeMillis();
         KerberosTime endTime = new KerberosTime( now + ONE_DAY );
-        encTicketModifier.setEndTime( endTime );
+        encTicketPart.setEndTime( endTime );
 
         KerberosTime renewTill = new KerberosTime( now + ONE_WEEK );
-        encTicketModifier.setRenewTill( renewTill );
-
-        EncTicketPart encTicketPart = encTicketModifier.getEncTicketPart();
+        encTicketPart.setRenewTill( renewTill );
 
         EncryptedData encryptedTicketPart = cipherTextHandler.seal( serverKey, encTicketPart,
KeyUsage.NUMBER2 );
 
         Ticket ticket = new Ticket();
         ticket.setTktVno( KerberosConstants.KERBEROS_V5 );
-        ticket.setSName( serverPrincipal );
+        ticket.setSName( new PrincipalName( serverPrincipal.getName(), PrincipalNameType.KRB_NT_PRINCIPAL
) );
+        ticket.setRealm( serverPrincipal.getRealm() );
         ticket.setEncPart( encryptedTicketPart );
 
-        ticket.setEncPart( encTicketPart );
-
         return ticket;
     }
 
@@ -137,11 +137,10 @@ public class TicketFactory
      */
     public KerberosTicket getKerberosTicket( Ticket ticket ) throws IOException
     {
-        
         byte[] asn1Encoding = ticket.encode( null ).array();
-
-        KerberosPrincipal client = ticket.getEncTicketPart().getClientPrincipal();
-        KerberosPrincipal server = ticket.getServerPrincipal();
+        
+        KerberosPrincipal client = KerberosUtils.getKerberosPrincipal( ticket.getEncTicketPart().getCName(),
ticket.getEncTicketPart().getCRealm() );
+        KerberosPrincipal server = KerberosUtils.getKerberosPrincipal( ticket.getSName(),
ticket.getRealm() );
         byte[] sessionKey = ticket.getEncTicketPart().getKey().getKeyValue();
         int keyType = ticket.getEncTicketPart().getKey().getKeyType().getValue();
 

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=1042725&r1=1042724&r2=1042725&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
Mon Dec  6 17:13:54 2010
@@ -177,16 +177,15 @@ public abstract class AbstractTicketGran
     }
 
 
-    protected Ticket getTicket( EncTicketPartModifier encTicketModifier, KerberosPrincipal
serverPrincipal,
+    protected Ticket getTicket( EncTicketPart encTicketPart, KerberosPrincipal serverPrincipal,
         EncryptionKey serverKey ) throws KerberosException
     {
-        EncTicketPart encTicketPart = encTicketModifier.getEncTicketPart();
-
         EncryptedData encryptedTicketPart = lockBox.seal( serverKey, encTicketPart, KeyUsage.NUMBER2
);
 
         Ticket ticket = new Ticket();
         ticket.setTktVno( 5 );
-        ticket.setServerPrincipal( serverPrincipal );
+        ticket.setSName( serverPrincipal );
+        ticket.setRealm( realm );
         ticket.setEncPart( encryptedTicketPart );
 
         ticket.setEncTicketPart( encTicketPart );



Mime
View raw message