directory-commits mailing list archives

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

Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBody.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBodyModifier.java
Log:
Replacing Realm and PrincipalName with JAAS KerberosPrincipal.  Moving value objects to immutable
value, mutable companion pattern.

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBody.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBody.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBody.java
Sat Oct 30 17:55:55 2004
@@ -19,30 +19,30 @@
 import org.apache.kerberos.crypto.encryption.*;
 import org.apache.kerberos.messages.components.*;
 
+import javax.security.auth.kerberos.*;
+
 public class RequestBody {
 
-	private KdcOptions       _kdcOptions;
-	private PrincipalName    _cname;                //optional in TgsReq only
-	private Realm            _realm;
-	private PrincipalName    _sname;                //optional
-	private KerberosTime     _from;                 //optional
-	private KerberosTime     _till;
-	private KerberosTime     _rtime;                //optional
-	private int              _nonce;
-	private EncryptionType[] _eType;
-	private HostAddresses    _addresses;            //optional
-	private EncryptedData    _encAuthorizationData; //optional
-	private Ticket[]         _additionalTickets;    //optional
+	private KdcOptions        _kdcOptions;
+	private KerberosPrincipal _clientPrincipal;      //optional in TgsReq only
+	private KerberosPrincipal _serverPrincipal;
+	private KerberosTime      _from;                 //optional
+	private KerberosTime      _till;
+	private KerberosTime      _rtime;                //optional
+	private int               _nonce;
+	private EncryptionType[]  _eType;
+	private HostAddresses     _addresses;            //optional
+	private EncryptedData     _encAuthorizationData; //optional
+	private Ticket[]          _additionalTickets;    //optional
 
-	public RequestBody(KdcOptions kdcOptions, PrincipalName cname, Realm realm,
-			PrincipalName sname, KerberosTime from, KerberosTime till, KerberosTime rtime,
+	public RequestBody(KdcOptions kdcOptions, KerberosPrincipal clientPrincipal,
+			KerberosPrincipal serverPrincipal, KerberosTime from, KerberosTime till, KerberosTime
rtime,
 			int nonce, EncryptionType[] eType, HostAddresses addresses, EncryptedData encAuthorizationData,
 			Ticket[] additionalTickets) {
 		
 		_kdcOptions           = kdcOptions;
-		_cname                = cname;
-		_realm                = realm;
-		_sname                = sname;
+		_clientPrincipal      = clientPrincipal;
+		_serverPrincipal      = serverPrincipal;
 		_from                 = from;
 		_till                 = till;
 		_rtime                = rtime;
@@ -59,11 +59,11 @@
 	public HostAddresses getAddresses() {
 		return _addresses;
 	}
-	public PrincipalName getCname() {
-		return _cname;
+	public KerberosPrincipal getClientPrincipal() {
+		return _clientPrincipal;
 	}
-	public Realm getRealm() {
-		return _realm;
+	public KerberosPrincipal getServerPrincipal() {
+		return _serverPrincipal;
 	}
 	public EncryptedData getEncAuthorizationData() {
 		return _encAuthorizationData;
@@ -82,9 +82,6 @@
 	}
 	public KerberosTime getRtime() {
 		return _rtime;
-	}
-	public PrincipalName getSname() {
-		return _sname;
 	}
 	public KerberosTime getTill() {
 		return _till;

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBodyModifier.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBodyModifier.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/RequestBodyModifier.java
Sat Oct 30 17:55:55 2004
@@ -19,12 +19,13 @@
 import org.apache.kerberos.crypto.encryption.*;
 import org.apache.kerberos.messages.components.*;
 
+import javax.security.auth.kerberos.*;
+
 public class RequestBodyModifier {
 	
+	private KerberosPrincipalModifier _clientModifier = new KerberosPrincipalModifier(); //optional
in TgsReq only
+	private KerberosPrincipalModifier _serverModifier = new KerberosPrincipalModifier();
 	private KdcOptions       _kdcOptions;
-	private PrincipalName    _cname;                //optional in TgsReq only
-	private Realm            _realm;
-	private PrincipalName    _sname;                //optional
 	private KerberosTime     _from;                 //optional
 	private KerberosTime     _till;
 	private KerberosTime     _rtime;                //optional
@@ -35,22 +36,29 @@
 	private Ticket[]         _additionalTickets;    //optional
 	
 	public RequestBody getRequestBody() {
-		return new RequestBody(_kdcOptions, _cname, _realm, _sname, _from, _till, _rtime,
+		KerberosPrincipal clientPrincipal = _clientModifier.getKerberosPrincipal();
+		KerberosPrincipal serverPrincipal = _serverModifier.getKerberosPrincipal();
+		
+		return new RequestBody(_kdcOptions, clientPrincipal, serverPrincipal, _from, _till, _rtime,
 			_nonce, _eType, _addresses, _encAuthorizationData, _additionalTickets);
 	}
 	
+	public void setClientName(PrincipalName clientName) {
+		_clientModifier.setPrincipalName(clientName);
+	}
+	public void setServerName(PrincipalName serverName) {
+		_serverModifier.setPrincipalName(serverName);
+	}
+	public void setRealm(String realm) {
+		_clientModifier.setRealm(realm);
+		_serverModifier.setRealm(realm);
+	}
 	public void setAdditionalTickets(Ticket[] tickets) {
 		_additionalTickets = tickets;
 	}
 	public void setAddresses(HostAddresses addresses) {
 		_addresses = addresses;
 	}
-	public void setCname(PrincipalName cname) {
-		_cname = cname;
-	}
-	public void setRealm(Realm realm) {
-		_realm = realm;
-	}
 	public void setEncAuthorizationData(EncryptedData authorizationData) {
 		_encAuthorizationData = authorizationData;
 	}
@@ -68,9 +76,6 @@
 	}
 	public void setRtime(KerberosTime rtime) {
 		_rtime = rtime;
-	}
-	public void setSname(PrincipalName sname) {
-		_sname = sname;
 	}
 	public void setTill(KerberosTime till) {
 		_till = till;

Mime
View raw message