directory-commits mailing list archives

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

Added:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/EncTicketPartModifier.java
Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/EncTicketPart.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/messages/components/EncTicketPart.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/EncTicketPart.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/EncTicketPart.java
Sat Oct 30 17:47:25 2004
@@ -18,15 +18,16 @@
 
 import org.apache.kerberos.messages.value.*;
 
+import javax.security.auth.kerberos.*;
+
 /**
  * Encrypted part of Tickets
  */
 public class EncTicketPart {
 
-	private TicketFlags       _flags = new TicketFlags();
+	private TicketFlags       _flags;
 	private EncryptionKey     _sessionKey;
-	private Realm             _clientRealm;
-	private PrincipalName     _clientName;
+	private KerberosPrincipal _clientPrincipal;
 	private TransitedEncoding _transitedEncoding;
 	private KerberosTime      _authtime;
 	private KerberosTime      _startTime;         //optional
@@ -34,20 +35,15 @@
 	private KerberosTime      _renewTill;         //optional
 	private HostAddresses     _clientAddresses;   //optional
 	private AuthorizationData _authorizationData; //optional
-	
-	public EncTicketPart() {
-		// Used to create new tickets
-	}
 
-	public EncTicketPart(TicketFlags flags, EncryptionKey key, Realm crealm, PrincipalName cname,
+	public EncTicketPart(TicketFlags flags, EncryptionKey key, KerberosPrincipal clientPrincipal,
 			TransitedEncoding transited, KerberosTime authtime, KerberosTime starttime,
 			KerberosTime endtime, KerberosTime renewTill, HostAddresses caddr,
 			AuthorizationData authorizationData) {
 		
 		_flags             = flags;
 		_sessionKey        = key;
-		_clientRealm       = crealm;
-		_clientName        = cname;
+		_clientPrincipal   = clientPrincipal;
 		_transitedEncoding = transited;
 		_authtime          = authtime;
 		_startTime         = starttime;
@@ -60,17 +56,17 @@
 	public AuthorizationData getAuthorizationData() {
 		return _authorizationData;
 	}
-	public KerberosTime getAuthtime() {
+	public KerberosTime getAuthTime() {
 		return _authtime;
 	}
 	public HostAddresses getClientAddresses() {
 		return _clientAddresses;
 	}
-	public PrincipalName getClientName() {
-		return _clientName;
+	public KerberosPrincipal getClientPrincipal() {
+		return _clientPrincipal;
 	}
-	public Realm getClientRealm() {
-		return _clientRealm;
+	public String getClientRealm() {
+		return _clientPrincipal.getRealm();
 	}
 	public KerberosTime getEndTime() {
 		return _endTime;
@@ -89,41 +85,6 @@
 	}
 	public TransitedEncoding getTransitedEncoding() {
 		return _transitedEncoding;
-	}
-	
-	
-	public void setAuthorizationData(AuthorizationData data) {
-		_authorizationData = data;
-	}
-	public void setAuthtime(KerberosTime authtime) {
-		_authtime = authtime;
-	}
-	public void setClientAddresses(HostAddresses addresses) {
-		_clientAddresses = addresses;
-	}
-	public void setClientName(PrincipalName name) {
-		_clientName = name;
-	}
-	public void setClientRealm(Realm realm) {
-		_clientRealm = realm;
-	}
-	public void setEndTime(KerberosTime time) {
-		_endTime = time;
-	}
-	public void setFlags(TicketFlags flags) {
-		_flags = flags;
-	}
-	public void setRenewTill(KerberosTime till) {
-		_renewTill = till;
-	}
-	public void setSessionKey(EncryptionKey key) {
-		_sessionKey = key;
-	}
-	public void setStartTime(KerberosTime time) {
-		_startTime = time;
-	}
-	public void setTransitedEncoding(TransitedEncoding encoding) {
-		_transitedEncoding = encoding;
 	}
 }
 

Added: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/EncTicketPartModifier.java
==============================================================================
--- (empty file)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/EncTicketPartModifier.java
Sat Oct 30 17:47:25 2004
@@ -0,0 +1,93 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.kerberos.messages.components;
+
+import org.apache.kerberos.messages.value.*;
+
+import javax.security.auth.kerberos.*;
+
+/**
+ * Encrypted part of Tickets
+ */
+public class EncTicketPartModifier {
+
+	private TicketFlags               _flags = new TicketFlags();
+	private EncryptionKey             _sessionKey;
+	private KerberosPrincipalModifier _modifier = new KerberosPrincipalModifier();
+	private KerberosPrincipal         _clientPrincipal;
+	private TransitedEncoding         _transitedEncoding;
+	private KerberosTime              _authTime;
+	private KerberosTime              _startTime;         //optional
+	private KerberosTime              _endTime;
+	private KerberosTime              _renewTill;         //optional
+	private HostAddresses             _clientAddresses;   //optional
+	private AuthorizationData         _authorizationData; //optional
+
+	public EncTicketPart getEncTicketPart() {
+		
+		if (_clientPrincipal == null) {
+			_clientPrincipal = _modifier.getKerberosPrincipal();
+		}
+		
+		return new EncTicketPart(_flags, _sessionKey, _clientPrincipal, _transitedEncoding,
+			_authTime, _startTime, _endTime, _renewTill, _clientAddresses, _authorizationData);
+	}
+	
+	public void setClientName(PrincipalName name) {
+		_modifier.setPrincipalName(name);
+	}
+	public void setClientRealm(String realm) {
+		_modifier.setRealm(realm);
+	}
+	public void setClientPrincipal(KerberosPrincipal principal) {
+		_clientPrincipal = principal;
+	}
+	public void setAuthorizationData(AuthorizationData data) {
+		_authorizationData = data;
+	}
+	public void setAuthTime(KerberosTime authtime) {
+		_authTime = authtime;
+	}
+	public void setClientAddresses(HostAddresses addresses) {
+		_clientAddresses = addresses;
+	}
+	public void setEndTime(KerberosTime time) {
+		_endTime = time;
+	}
+	public void setFlags(TicketFlags flags) {
+		_flags = flags;
+	}
+	public void setFlag(int flag) {
+		_flags.set(flag);
+	}
+	public void clearFlag(int flag) {
+		_flags.clear(flag);
+	}
+	public void setRenewTill(KerberosTime till) {
+		_renewTill = till;
+	}
+	public void setSessionKey(EncryptionKey key) {
+		_sessionKey = key;
+	}
+	public void setStartTime(KerberosTime time) {
+		_startTime = time;
+	}
+	public void setTransitedEncoding(TransitedEncoding encoding) {
+		_transitedEncoding = encoding;
+	}
+}
+

Mime
View raw message