Author: erodriguez
Date: Thu Oct 21 04:03:25 2004
New Revision: 55217

Added:
   
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:
New model for storing principal data, modeled after krb5-kdc.schema.

Added: 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStore.java
==============================================================================
--- (empty file)
+++ 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStore.java
    Thu Oct 21 04:03:25 2004
@@ -0,0 +1,26 @@
+/*
+ *   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.kdc.store;
+
+import org.apache.kerberos.kdc.*;
+import org.apache.kerberos.messages.value.*;
+
+public interface PrincipalStore {
+       public void init();
+       public PrincipalStoreEntry getEntry(PrincipalName name) throws 
KerberosException;
+}
+

Added: 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntry.java
==============================================================================
--- (empty file)
+++ 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntry.java
       Thu Oct 21 04:03: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.kdc.store;
+
+import org.apache.kerberos.crypto.encryption.*;
+import org.apache.kerberos.messages.value.*;
+
+public class PrincipalStoreEntry {
+       
+       // 'Principal'
+       private String _commonName;
+       private String _principalName;
+       private String _principalRealm;
+       
+       // 'KDCEntry'
+       private KerberosTime  _validStart;
+       private KerberosTime  _validEnd;
+       private KerberosTime  _passwordEnd;
+       private int           _maxLife;
+       private int           _maxRenew;
+       private int           _kdcFlags;
+       private EncryptionKey _key;
+       
+       private String _realmName;
+       
+       PrincipalStoreEntry(String commonName, String principalName, String 
principalRealm,
+                       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;
+               _validStart       = validStart;
+               _validEnd         = validEnd;
+               _passwordEnd      = passwordEnd;
+               _maxLife          = maxLife;
+               _maxRenew         = maxRenew;
+               _kdcFlags         = kdcFlags;
+               _realmName        = realmName;
+               
+               _key = new 
EncryptionKey(EncryptionType.getTypeByOrdinal(keyType), key, keyVersionNumber);
+       }
+       
+       public String getCommonName() {
+               return _commonName;
+       }
+       public EncryptionKey getEncryptionKey() {
+               return _key;
+       }
+       public int getKDCFlags() {
+               return _kdcFlags;
+       }
+       public int getMaxLife() {
+               return _maxLife;
+       }
+       public int getMaxRenew() {
+               return _maxRenew;
+       }
+       public KerberosTime getPasswordEnd() {
+               return _passwordEnd;
+       }
+       public String getPrincipalName() {
+               return _principalName;
+       }
+       public String getPrincipalRealm() {
+               return _principalRealm;
+       }
+       public String getRealmName() {
+               return _realmName;
+       }
+       public KerberosTime getValidEnd() {
+               return _validEnd;
+       }
+       public KerberosTime getValidStart() {
+               return _validStart;
+       }
+}
+

Added: 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntryModifier.java
==============================================================================
--- (empty file)
+++ 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/store/PrincipalStoreEntryModifier.java
       Thu Oct 21 04:03:25 2004
@@ -0,0 +1,88 @@
+/*
+ *   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.kdc.store;
+
+import org.apache.kerberos.messages.value.*;
+
+public class PrincipalStoreEntryModifier {
+       
+       // 'Principal'
+       private String _commonName;
+       private String _principalName;
+       private String _principalRealm;
+       
+       // 'KDCEntry'
+       private int _keyVersionNumber; // must
+       // may
+       private KerberosTime _validStart;
+       private KerberosTime _validEnd;
+       private KerberosTime _passwordEnd;
+       private int          _maxLife;
+       private int          _maxRenew;
+       private int          _kdcFlags;
+       private int          _encryptionType;
+       private byte[]       _key;
+       
+       private String _realmName;
+       
+       public PrincipalStoreEntry getEntry() {
+               return new PrincipalStoreEntry(_commonName, _principalName, 
_principalRealm,
+                               _keyVersionNumber, _validStart, _validEnd, 
_passwordEnd, _maxLife, _maxRenew,
+                               _kdcFlags, _encryptionType, _key, _realmName);
+       }
+
+       public void setCommonName(String commonName) {
+               _commonName = commonName;
+       }
+       public void setEncryptionType(int encryptionType) {
+               _encryptionType = encryptionType;
+       }
+       public void setKDCFlags(int kdcFlags) {
+               _kdcFlags = kdcFlags;
+       }
+       public void setKey(byte[] key) {
+               _key = key;
+       }
+       public void setKeyVersionNumber(int keyVersionNumber) {
+               _keyVersionNumber = keyVersionNumber;
+       }
+       public void setMaxLife(int maxLife) {
+               _maxLife = maxLife;
+       }
+       public void setMaxRenew(int maxRenew) {
+               _maxRenew = maxRenew;
+       }
+       public void setPasswordEnd(KerberosTime passwordEnd) {
+               _passwordEnd = passwordEnd;
+       }
+       public void setPrincipalName(String principalName) {
+               _principalName = principalName;
+       }
+       public void setPrincipalRealm(String principalRealm) {
+               _principalRealm = principalRealm;
+       }
+       public void setRealmName(String realmName) {
+               _realmName = realmName;
+       }
+       public void setValidEnd(KerberosTime validEnd) {
+               _validEnd = validEnd;
+       }
+       public void setValidStart(KerberosTime validStart) {
+               _validStart = validStart;
+       }
+}
+

Reply via email to