Author: erodriguez
Date: Sat Oct 30 17:53:33 2004
New Revision: 56100

Added:
   
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/PrincipalName.java
   
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/PrincipalNameModifier.java
Log:
Helper classes for converting PrincipalNames coming in off the wire to JAAS 
KerberosPrincipals.

Added: 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/PrincipalName.java
==============================================================================
--- (empty file)
+++ 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/PrincipalName.java
        Sat Oct 30 17:53:33 2004
@@ -0,0 +1,37 @@
+/*
+ *   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.value;
+
+public class PrincipalName {
+       
+       private String _nameComponent;
+       private int    _nameType;
+       
+       public PrincipalName(String nameComponent, int nameType) {
+               _nameComponent = nameComponent;
+               _nameType      = nameType;
+       }
+
+       public int getNameType() {
+               return _nameType;
+       }
+
+       public String getNameComponent() {
+               return _nameComponent;
+       }
+}
+

Added: 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/PrincipalNameModifier.java
==============================================================================
--- (empty file)
+++ 
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/PrincipalNameModifier.java
        Sat Oct 30 17:53:33 2004
@@ -0,0 +1,49 @@
+/*
+ *   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.value;
+
+import java.util.*;
+
+public class PrincipalNameModifier {
+       
+       private static final String COMPONENT_SEPARATOR = "/";
+       
+       List   _components = new ArrayList();
+       int    _nameType;
+       
+       public PrincipalName getPrincipalName() {
+               StringBuffer sb = new StringBuffer();
+               Iterator it = _components.iterator();
+               while (it.hasNext()) {
+                       String component = (String)it.next();
+                       sb.append(component);
+                       if (it.hasNext()) {
+                               sb.append(COMPONENT_SEPARATOR);
+                       }
+               }
+               return new PrincipalName(sb.toString(), _nameType);
+       }
+
+       public void setType(int type) {
+               _nameType = type;
+       }
+
+       public void addName(String name) {
+               _components.add(name);
+       }
+}
+

Reply via email to