directory-commits mailing list archives

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

Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/LdapStore.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStore.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntry.java
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntryModifier.java
Log:
Replacing Realm and PrincipalName with JAAS KerberosPrincipal.

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/LdapStore.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/LdapStore.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/LdapStore.java
Sat Oct 30 17:24:15 2004
@@ -18,7 +18,6 @@
 
 import org.apache.kerberos.kdc.*;
 import org.apache.kerberos.kdc.jaas.*;
-import org.apache.kerberos.messages.value.*;
 
 import java.security.*;
 import java.util.*;
@@ -26,6 +25,7 @@
 import javax.naming.*;
 import javax.naming.directory.*;
 import javax.security.auth.*;
+import javax.security.auth.kerberos.*;
 
 public class LdapStore implements PrincipalStore {
 	
@@ -52,17 +52,17 @@
 		}
 	}
 	
-	public PrincipalStoreEntry getEntry(PrincipalName name) {
-		return (PrincipalStoreEntry)Subject.doAs(_subject, new JaasLdapLookupAction(name));
+	public PrincipalStoreEntry getEntry(KerberosPrincipal principal) {
+		return (PrincipalStoreEntry)Subject.doAs(_subject, new JaasLdapLookupAction(principal));
 	}
 }
 
 class JaasLdapLookupAction implements PrivilegedAction {
 
-	private PrincipalName       _principal;
+	private KerberosPrincipal   _principal;
 	private PrincipalStoreEntry _entry;
 
-	public JaasLdapLookupAction(PrincipalName principal) {
+	public JaasLdapLookupAction(KerberosPrincipal principal) {
 		_principal = principal;
 	}
 
@@ -135,7 +135,7 @@
 				String keyVersionNumber = (String) attrs.get(LdapStore.KEY_VERSION_NUMBER).get();
 				byte[] keyBytes         = (byte[]) attrs.get(LdapStore.KEY).get();
 				
-				modifier.setPrincipalName(principal);
+				modifier.setPrincipal(new KerberosPrincipal(principal));
 				modifier.setEncryptionType(Integer.parseInt(encryptionType));
 				modifier.setKeyVersionNumber(Integer.parseInt(keyVersionNumber));
 				modifier.setKey(keyBytes);

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStore.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStore.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStore.java
Sat Oct 30 17:24:15 2004
@@ -17,10 +17,11 @@
 package org.apache.kerberos.kdc.store;
 
 import org.apache.kerberos.kdc.*;
-import org.apache.kerberos.messages.value.*;
+
+import javax.security.auth.kerberos.*;
 
 public interface PrincipalStore {
 	public void init();
-	public PrincipalStoreEntry getEntry(PrincipalName name) throws KerberosException;
+	public PrincipalStoreEntry getEntry(KerberosPrincipal principal) throws KerberosException;
 }
 

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntry.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntry.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntry.java
Sat Oct 30 17:24:15 2004
@@ -19,12 +19,13 @@
 import org.apache.kerberos.crypto.encryption.*;
 import org.apache.kerberos.messages.value.*;
 
+import javax.security.auth.kerberos.*;
+
 public class PrincipalStoreEntry {
 	
 	// 'Principal'
-	private String _commonName;
-	private String _principalName;
-	private String _principalRealm;
+	private String            _commonName;
+	private KerberosPrincipal _principal;
 	
 	// 'KDCEntry'
 	private KerberosTime  _validStart;
@@ -37,14 +38,13 @@
 	
 	private String _realmName;
 	
-	PrincipalStoreEntry(String commonName, String principalName, String principalRealm,
+	PrincipalStoreEntry(String commonName, KerberosPrincipal principal,
 			int keyVersionNumber, KerberosTime validStart, KerberosTime validEnd,
 			KerberosTime passwordEnd, int maxLife, int maxRenew, int kdcFlags,
 			int keyType, byte[] key, String realmName) {
 		
 		_commonName       = commonName;
-		_principalName    = principalName;
-		_principalRealm   = principalRealm;
+		_principal        = principal;
 		_validStart       = validStart;
 		_validEnd         = validEnd;
 		_passwordEnd      = passwordEnd;
@@ -74,11 +74,8 @@
 	public KerberosTime getPasswordEnd() {
 		return _passwordEnd;
 	}
-	public String getPrincipalName() {
-		return _principalName;
-	}
-	public String getPrincipalRealm() {
-		return _principalRealm;
+	public KerberosPrincipal getPrincipal() {
+		return _principal;
 	}
 	public String getRealmName() {
 		return _realmName;

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntryModifier.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntryModifier.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntryModifier.java
Sat Oct 30 17:24:15 2004
@@ -18,12 +18,13 @@
 
 import org.apache.kerberos.messages.value.*;
 
+import javax.security.auth.kerberos.*;
+
 public class PrincipalStoreEntryModifier {
 	
 	// 'Principal'
-	private String _commonName;
-	private String _principalName;
-	private String _principalRealm;
+	private String            _commonName;
+	private KerberosPrincipal _principal;
 	
 	// 'KDCEntry'
 	private int _keyVersionNumber; // must
@@ -40,8 +41,8 @@
 	private String _realmName;
 	
 	public PrincipalStoreEntry getEntry() {
-		return new PrincipalStoreEntry(_commonName, _principalName, _principalRealm,
-				_keyVersionNumber, _validStart, _validEnd, _passwordEnd, _maxLife, _maxRenew,
+		return new PrincipalStoreEntry(_commonName, _principal, _keyVersionNumber,
+				_validStart, _validEnd, _passwordEnd, _maxLife, _maxRenew,
 				_kdcFlags, _encryptionType, _key, _realmName);
 	}
 
@@ -69,11 +70,8 @@
 	public void setPasswordEnd(KerberosTime passwordEnd) {
 		_passwordEnd = passwordEnd;
 	}
-	public void setPrincipalName(String principalName) {
-		_principalName = principalName;
-	}
-	public void setPrincipalRealm(String principalRealm) {
-		_principalRealm = principalRealm;
+	public void setPrincipal(KerberosPrincipal principal) {
+		_principal = principal;
 	}
 	public void setRealmName(String realmName) {
 		_realmName = realmName;

Mime
View raw message