directory-commits mailing list archives

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

Added:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/AuthenticatorModifier.java
Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/Authenticator.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/Authenticator.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/Authenticator.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/Authenticator.java
Sat Oct 30 17:34:59 2004
@@ -16,14 +16,16 @@
  */
 package org.apache.kerberos.messages.components;
 
-import org.apache.kerberos.kdc.*;
 import org.apache.kerberos.messages.value.*;
 
+import javax.security.auth.kerberos.*;
+
 public class Authenticator {
 	
+	public static final int AUTHENTICATOR_VNO = 5;
+	
 	private int               _versionNumber;
-	private Realm             _clientRealm;
-	private PrincipalName     _clientName;
+	private KerberosPrincipal _clientPrincipal;
 	private Checksum          _checksum;
 	private int               _clientMicroSecond;
 	private KerberosTime      _clientTime;
@@ -31,30 +33,30 @@
 	private int               _sequenceNumber;
 	private AuthorizationData _authorizationData;
 	
-	public Authenticator() {
-		// TODO - probably temp
+	public Authenticator(KerberosPrincipal clientPrincipal, Checksum checksum,
+			int cusec, KerberosTime clientTime, EncryptionKey subSessionKey, int sequenceNumber,
+			AuthorizationData authorizationData) {
+		
+		this(AUTHENTICATOR_VNO, clientPrincipal, checksum, cusec, clientTime,
+		 		subSessionKey, sequenceNumber, authorizationData);
 	}
 
-	public Authenticator(Realm crealm, PrincipalName cname, Checksum cksum,	int cusec,
-			KerberosTime ctime, EncryptionKey subKey, int seqNumber,
+	public Authenticator(int versionNumber, KerberosPrincipal clientPrincipal, Checksum checksum,
+			int cusec, KerberosTime clientTime, EncryptionKey subSessionKey, int sequenceNumber,
 			AuthorizationData authorizationData) {
 		
-		_versionNumber     = LocalConfig.AUTHENTICATOR_VNO;
-		_clientRealm       = crealm;
-		_clientName        = cname;
-		_checksum          = cksum;
+		_versionNumber     = versionNumber;
+		_clientPrincipal   = clientPrincipal;
+		_checksum          = checksum;
 		_clientMicroSecond = cusec;
-		_clientTime        = ctime;
-		_subSessionKey     = subKey;
-		_sequenceNumber    = seqNumber;
+		_clientTime        = clientTime;
+		_subSessionKey     = subSessionKey;
+		_sequenceNumber    = sequenceNumber;
 		_authorizationData = authorizationData;
 	}
 	
-	public PrincipalName getClientName() {
-		return _clientName;
-	}
-	public Realm getClientRealm() {
-		return _clientRealm;
+	public KerberosPrincipal getClientPrincipal() {
+		return _clientPrincipal;
 	}
 	public KerberosTime getClientTime() {
 		return _clientTime;
@@ -76,35 +78,6 @@
 	}
 	public int getVersionNumber() {
 		return _versionNumber;
-	}
-	
-	// setters
-	public void setAuthorizationData(AuthorizationData data) {
-		_authorizationData = data;
-	}
-	public void setChecksum(Checksum checksum) {
-		_checksum = checksum;
-	}
-	public void setClientMicroSecond(int microSecond) {
-		_clientMicroSecond = microSecond;
-	}
-	public void setClientName(PrincipalName name) {
-		_clientName = name;
-	}
-	public void setClientRealm(Realm realm) {
-		_clientRealm = realm;
-	}
-	public void setClientTime(KerberosTime time) {
-		_clientTime = time;
-	}
-	public void setSequenceNumber(int number) {
-		_sequenceNumber = number;
-	}
-	public void setSubSessionKey(EncryptionKey sessionKey) {
-		_subSessionKey = sessionKey;
-	}
-	public void setVersionNumber(int number) {
-		_versionNumber = number;
 	}
 }
 

Added: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/AuthenticatorModifier.java
==============================================================================
--- (empty file)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/components/AuthenticatorModifier.java
Sat Oct 30 17:34:59 2004
@@ -0,0 +1,70 @@
+/*
+ *   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.*;
+
+public class AuthenticatorModifier {
+	
+	private int                       _versionNumber;
+	private KerberosPrincipalModifier _clientModifier = new KerberosPrincipalModifier();
+	private Checksum                  _checksum;
+	private int                       _clientMicroSecond;
+	private KerberosTime              _clientTime;
+	private EncryptionKey             _subSessionKey;
+	private int                       _sequenceNumber;
+	private AuthorizationData         _authorizationData;
+	
+	public Authenticator getAuthenticator() {
+		
+		KerberosPrincipal clientPrincipal = _clientModifier.getKerberosPrincipal();
+		
+		return new Authenticator(_versionNumber, clientPrincipal, _checksum, _clientMicroSecond,
+			_clientTime, _subSessionKey, _sequenceNumber, _authorizationData);
+	}
+	
+	public void setVersionNumber(int versionNumber) {
+		_versionNumber = versionNumber;
+	}
+	public void setClientName(PrincipalName name) {
+		_clientModifier.setPrincipalName(name);
+	}
+	public void setClientRealm(String realm) {
+		_clientModifier.setRealm(realm);
+	}
+	public void setAuthorizationData(AuthorizationData data) {
+		_authorizationData = data;
+	}
+	public void setChecksum(Checksum checksum) {
+		_checksum = checksum;
+	}
+	public void setClientMicroSecond(int microSecond) {
+		_clientMicroSecond = microSecond;
+	}
+	public void setClientTime(KerberosTime time) {
+		_clientTime = time;
+	}
+	public void setSequenceNumber(int number) {
+		_sequenceNumber = number;
+	}
+	public void setSubSessionKey(EncryptionKey sessionKey) {
+		_subSessionKey = sessionKey;
+	}
+}
+

Mime
View raw message