directory-commits mailing list archives

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

Added:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/KerberosPrincipalModifier.java
Log:
Modifier for the JAAS KerberosPrincipal.

Added: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/KerberosPrincipalModifier.java
==============================================================================
--- (empty file)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/KerberosPrincipalModifier.java
Sat Oct 30 18:05:47 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 javax.security.auth.kerberos.*;
+
+public class KerberosPrincipalModifier {
+	
+	private static final String REALM_SEPARATOR = "@";
+	
+	PrincipalName _nameComponent;
+	String        _realm;
+	
+	public KerberosPrincipal getKerberosPrincipal() {
+		if (_nameComponent != null) {
+			StringBuffer sb = new StringBuffer();
+			sb.append(_nameComponent.getNameComponent());
+			if (_realm != null) {
+				sb.append(REALM_SEPARATOR);
+				sb.append(_realm);
+			}
+			return new KerberosPrincipal(sb.toString(), _nameComponent.getNameType());
+		}
+		return null;
+	}
+	
+	public void setPrincipalName(PrincipalName principalName) {
+		_nameComponent = principalName;
+	}
+
+	public void setRealm(String realm) {
+		_realm = realm;
+	}
+}
+

Mime
View raw message