directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: rev 56091 - incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder
Date Sun, 31 Oct 2004 00:18:37 GMT
Author: erodriguez
Date: Sat Oct 30 17:18:36 2004
New Revision: 56091

Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
Log:
Replacing Realm and PrincipalName with JAAS Kerberos Principal.  Moving value objects to immutable
value, mutable companion pattern.

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
Sat Oct 30 17:18:36 2004
@@ -55,7 +55,7 @@
 	}*/
 	private EncTicketPart decodeEncTicketPartSequence(DERSequence sequence) {
 		
-		EncTicketPart encPart = new EncTicketPart();
+		EncTicketPartModifier modifier = new EncTicketPartModifier();
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -64,54 +64,54 @@
 			switch (tag) {
 				case 0:
 					DERBitString tag0 = (DERBitString)derObject;
-					encPart.setFlags(new TicketFlags(tag0.getBytes()));
+					modifier.setFlags(new TicketFlags(tag0.getBytes()));
 					break;
 				case 1:
 					DERSequence tag1 = (DERSequence) derObject;
-					encPart.setSessionKey(decodeEncryptionKey(tag1));
+					modifier.setSessionKey(decodeEncryptionKey(tag1));
 					break;
 				case 2:
 					DERGeneralString tag2 = (DERGeneralString)derObject;
-					encPart.setClientRealm(new Realm(tag2.getString()));
+					modifier.setClientRealm(tag2.getString());
 					break;
 				case 3:
 					DERSequence tag3 = (DERSequence)derObject;
-					encPart.setClientName(decodePrincipalName(tag3));
+					modifier.setClientName(decodePrincipalName(tag3));
 					break;
 				case 4:
 					DERSequence tag4 = (DERSequence)derObject;
-					encPart.setTransitedEncoding(decodeTransitedEncoding(tag4));
+					modifier.setTransitedEncoding(decodeTransitedEncoding(tag4));
 					break;
 				case 5:
 					DERGeneralizedTime tag5 = (DERGeneralizedTime)derObject;
-					encPart.setAuthtime(decodeKerberosTime(tag5));
+					modifier.setAuthTime(decodeKerberosTime(tag5));
 					break;
 				case 6:
 					DERGeneralizedTime tag6 = (DERGeneralizedTime)derObject;
-					encPart.setStartTime(decodeKerberosTime(tag6));
+					modifier.setStartTime(decodeKerberosTime(tag6));
 					break;
 				case 7:
 					DERGeneralizedTime tag7 = (DERGeneralizedTime)derObject;
-					encPart.setEndTime(decodeKerberosTime(tag7));
+					modifier.setEndTime(decodeKerberosTime(tag7));
 					break;
 				case 8:
 					DERGeneralizedTime tag8 = (DERGeneralizedTime)derObject;
-					encPart.setRenewTill(decodeKerberosTime(tag8));
+					modifier.setRenewTill(decodeKerberosTime(tag8));
 					break;
 				case 9:
 					DERSequence tag9 = (DERSequence)derObject;
-					encPart.setClientAddresses(decodeHostAddresses(tag9));
+					modifier.setClientAddresses(decodeHostAddresses(tag9));
 					break;
 				case 10:
 					DERSequence tag10 = (DERSequence)derObject;
-					encPart.setAuthorizationData(decodeAuthorizationData(tag10));
+					modifier.setAuthorizationData(decodeAuthorizationData(tag10));
 					break;
 			    default:
 			    	System.out.println(derObject);
 			    	break;
 			}
 		}
-		return encPart;
+		return modifier.getEncTicketPart();
 	}
 }
 

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
Sat Oct 30 17:18:36 2004
@@ -106,7 +106,7 @@
 	
 	private PreAuthenticationData decodePreAuthenticationData(DERSequence sequence) {
 		
-		PreAuthenticationDataModifier paDataModifier = new PreAuthenticationDataModifier();
+		PreAuthenticationDataModifier modifier = new PreAuthenticationDataModifier();
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -116,18 +116,18 @@
 				case 1:
 					DERInteger padataType = (DERInteger) derObject;
 					PreAuthenticationDataType type = PreAuthenticationDataType.getTypeByOrdinal(padataType.getValue().intValue());
-					paDataModifier.setDataType(type);
+					modifier.setDataType(type);
 					break;
 				case 2:
 					DEROctetString padataValue = (DEROctetString) derObject;
-					paDataModifier.setDataValue(padataValue.getOctets());
+					modifier.setDataValue(padataValue.getOctets());
 					break;
 				default:
 					System.out.println(derObject);
 					break;
 			}
 		}
-		return paDataModifier.getPreAuthenticationData();
+		return modifier.getPreAuthenticationData();
 	}
 
 	/*
@@ -151,7 +151,7 @@
 	}*/
 	private RequestBody decodeRequestBody(DERSequence sequence) throws IOException {
 		
-		RequestBodyModifier requestBodyModifier = new RequestBodyModifier();
+		RequestBodyModifier modifier = new RequestBodyModifier();
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -160,51 +160,51 @@
 			switch (tag) {
 				case 0:
 					DERBitString kdcOptions = (DERBitString)derObject;
-					requestBodyModifier.setKdcOptions(new KdcOptions(kdcOptions.getBytes()));
+					modifier.setKdcOptions(new KdcOptions(kdcOptions.getBytes()));
 					break;
 				case 1:
 					DERSequence cName = (DERSequence)derObject;
-					requestBodyModifier.setCname(decodePrincipalName(cName));
+					modifier.setClientName(decodePrincipalName(cName));
 					break;
 				case 2:
 					DERGeneralString realm = (DERGeneralString)derObject;
-					requestBodyModifier.setRealm(new Realm(realm.getString()));
+					modifier.setRealm(realm.getString());
 					break;
 				case 3:
 					DERSequence sname = (DERSequence)derObject;
-					requestBodyModifier.setSname(decodePrincipalName(sname));
+					modifier.setServerName(decodePrincipalName(sname));
 					break;
 				case 4:
 					DERGeneralizedTime from = (DERGeneralizedTime)derObject;
-					requestBodyModifier.setFrom(decodeKerberosTime(from));
+					modifier.setFrom(decodeKerberosTime(from));
 					break;
 				case 5:
 					DERGeneralizedTime till = (DERGeneralizedTime)derObject;
-					requestBodyModifier.setTill(decodeKerberosTime(till));
+					modifier.setTill(decodeKerberosTime(till));
 					break;
 				case 6:
 					DERGeneralizedTime rtime = (DERGeneralizedTime)derObject;
-					requestBodyModifier.setRtime(decodeKerberosTime(rtime));
+					modifier.setRtime(decodeKerberosTime(rtime));
 					break;
 				case 7:
 					DERInteger nonce = (DERInteger)derObject;
-					requestBodyModifier.setNonce(nonce.getValue().intValue());
+					modifier.setNonce(nonce.getValue().intValue());
 					break;
 				case 8:
 					DERSequence etype = (DERSequence)derObject;
-					requestBodyModifier.setEType(decodeEncryptionType(etype));
+					modifier.setEType(decodeEncryptionType(etype));
 					break;
 				case 9:
 					DERSequence hostAddresses = (DERSequence)derObject;
-					requestBodyModifier.setAddresses(decodeHostAddresses(hostAddresses));
+					modifier.setAddresses(decodeHostAddresses(hostAddresses));
 					break;
 				case 10:
 					DERSequence encryptedData = (DERSequence)derObject;
-					requestBodyModifier.setEncAuthorizationData(decodeEncryptedData(encryptedData));
+					modifier.setEncAuthorizationData(decodeEncryptedData(encryptedData));
 					break;
 				case 11:
 					DERSequence tag11 = (DERSequence)derObject;
-					requestBodyModifier.setAdditionalTickets(decodeTickets(tag11));
+					modifier.setAdditionalTickets(decodeTickets(tag11));
 					break;
 			    default:
 			    	System.out.println(derObject);
@@ -212,7 +212,7 @@
 			}
 		}
 		
-		return requestBodyModifier.getRequestBody();
+		return modifier.getRequestBody();
 	}
 	
 	protected Ticket[] decodeTickets(DERSequence sequence) throws IOException {

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
Sat Oct 30 17:18:36 2004
@@ -39,7 +39,7 @@
 		
 		DERSequence sequence = (DERSequence) app.getObject();
 		
-		Ticket ticket = new Ticket();
+		TicketModifier modifier = new TicketModifier();
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -47,27 +47,27 @@
 			DERObject derObject = object.getObject();
 			switch (tag) {
 				case 0:
-					DERInteger etype = (DERInteger)derObject;
-					ticket.setTicketVersionNumber(etype.getValue().intValue());
+					DERInteger tag0 = (DERInteger)derObject;
+					modifier.setTicketVersionNumber(tag0.getValue().intValue());
 					break;
 				case 1:
 					DERGeneralString tag1 = (DERGeneralString)derObject;
-					ticket.setRealm(new Realm(tag1.getString()));
+					modifier.setServerRealm(tag1.getString());
 					break;
 				case 2:
 					DERSequence tag2 = (DERSequence)derObject;
-					ticket.setServerName(decodePrincipalName(tag2));
+					modifier.setServerName(decodePrincipalName(tag2));
 					break;
 				case 3:
 					DERSequence tag3 = (DERSequence)derObject;
-					ticket.setEncPart(decodeEncryptedData(tag3));
+					modifier.setEncPart(decodeEncryptedData(tag3));
 					break;
 			    default:
 			    	System.out.println(object.getObject());
 			    	break;
 			}
 		}
-		return ticket;
+		return modifier.getTicket();
 	}
 	
 	/*
@@ -112,7 +112,7 @@
 	}*/
 	protected PrincipalName decodePrincipalName(DERSequence sequence) {
 		
-		PrincipalName name = new PrincipalName();
+		PrincipalNameModifier modifier = new PrincipalNameModifier();
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -121,24 +121,24 @@
 			switch (tag) {
 				case 0:
 					DERInteger nameType = (DERInteger)derObject;
-					name.setNameType(nameType.getValue().intValue());
+					modifier.setType(nameType.getValue().intValue());
 					break;
 				case 1:
 					DERSequence nameString = (DERSequence)derObject;
-					decodeNameString(nameString, name);
+					decodeNameString(nameString, modifier);
 					break;
 			    default:
 			    	System.out.println(derObject);
 			    	break;
 			}
 		}
-		return name;
+		return modifier.getPrincipalName();
 	}
 	
-	private void decodeNameString(DERSequence sequence, PrincipalName name) {
+	private void decodeNameString(DERSequence sequence, PrincipalNameModifier modifier) {
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERGeneralString object = ((DERGeneralString) e.nextElement());
-			name.addName(object.getString());
+			modifier.addName(object.getString());
 		}
 	}
 	
@@ -381,7 +381,7 @@
 	*/
 	protected Authenticator decodeAuthenticator(DERSequence sequence) {
 		
-		Authenticator auth = new Authenticator();
+		AuthenticatorModifier modifier = new AuthenticatorModifier();
 		
 		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
 			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
@@ -390,46 +390,46 @@
 			switch (tag) {
 				case 0:
 					DERInteger tag0 = (DERInteger)derObject;
-					auth.setVersionNumber(tag0.getValue().intValue());
+					modifier.setVersionNumber(tag0.getValue().intValue());
 					break;
 				case 1:
 					DERGeneralString tag1 = (DERGeneralString)derObject;
-					auth.setClientRealm(new Realm(tag1.getString()));
+					modifier.setClientRealm(tag1.getString());
 					break;
 				case 2:
 					DERSequence tag2 = (DERSequence)derObject;
-					auth.setClientName(decodePrincipalName(tag2));
+					modifier.setClientName(decodePrincipalName(tag2));
 					break;
 				case 3:
 					DERSequence tag3 = (DERSequence)derObject;
-					auth.setChecksum(decodeChecksum(tag3));
+					modifier.setChecksum(decodeChecksum(tag3));
 					break;
 				case 4:
 					DERInteger tag4 = (DERInteger)derObject;
-					auth.setClientMicroSecond(tag4.getValue().intValue());
+					modifier.setClientMicroSecond(tag4.getValue().intValue());
 					break;
 				case 5:
 					DERGeneralizedTime tag5 = (DERGeneralizedTime)derObject;
-					auth.setClientTime(decodeKerberosTime(tag5));
+					modifier.setClientTime(decodeKerberosTime(tag5));
 					break;
 				case 6:
 					DERSequence tag6 = (DERSequence) derObject;
-					auth.setSubSessionKey(decodeEncryptionKey(tag6));
+					modifier.setSubSessionKey(decodeEncryptionKey(tag6));
 					break;
 				case 7:
 					DERInteger tag7 = (DERInteger)derObject;
-					auth.setSequenceNumber(tag7.getValue().intValue());
+					modifier.setSequenceNumber(tag7.getValue().intValue());
 					break;
 				case 8:
 					DERSequence tag8 = (DERSequence)derObject;
-					auth.setAuthorizationData(decodeAuthorizationData(tag8));
+					modifier.setAuthorizationData(decodeAuthorizationData(tag8));
 					break;
 			    default:
 			    	System.out.println(derObject);
 			    	break;
 			}
 		}
-		return auth;
+		return modifier.getAuthenticator();
 	}
 }
 

Mime
View raw message