Return-Path: Delivered-To: apmail-incubator-directory-cvs-archive@www.apache.org Received: (qmail 77841 invoked from network); 31 Oct 2004 01:05:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 31 Oct 2004 01:05:49 -0000 Received: (qmail 44982 invoked by uid 500); 31 Oct 2004 01:05:49 -0000 Delivered-To: apmail-incubator-directory-cvs-archive@incubator.apache.org Received: (qmail 44933 invoked by uid 500); 31 Oct 2004 01:05:49 -0000 Mailing-List: contact directory-cvs-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: directory-dev@incubator.apache.org Delivered-To: mailing list directory-cvs@incubator.apache.org Received: (qmail 44919 invoked by uid 99); 31 Oct 2004 01:05:48 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 30 Oct 2004 18:05:48 -0700 Received: (qmail 77827 invoked by uid 65534); 31 Oct 2004 01:05:47 -0000 Date: 31 Oct 2004 01:05:47 -0000 Message-ID: <20041031010547.77825.qmail@minotaur.apache.org> From: erodriguez@apache.org To: directory-cvs@incubator.apache.org Subject: svn commit: rev 56103 - incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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; + } +} +