2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class encapsulates a Kerberos principal. 0N/A * @author Mayank Upadhyay 0N/A * unknown name type. 0N/A * user principal name type. 0N/A * service and other unique instance (krbtgt) name type. 0N/A * service with host name as instance (telnet, rcommands) name type. 0N/A * service with host as remaining components name type. 0N/A * unique ID name type. 0N/A * Constructs a KerberosPrincipal from the provided string input. The 0N/A * name type for this principal defaults to 0N/A * {@link #KRB_NT_PRINCIPAL KRB_NT_PRINCIPAL} 0N/A * This string is assumed to contain a name in the format 0N/A * that is specified in Section 2.1.1. (Kerberos Principal Name Form) of 0N/A * (for example, <i>duke@FOO.COM</i>, where <i>duke</i> 0N/A * represents a principal, and <i>FOO.COM</i> represents a realm). 0N/A * <p>If the input name does not contain a realm, the default realm 0N/A * is used. The default realm can be specified either in a Kerberos 0N/A * configuration file or via the java.security.krb5.realm 0N/A * system property. For more information, 0N/A * Kerberos Requirements </a> 0N/A * @param name the principal name 0N/A * @throws IllegalArgumentException if name is improperly 0N/A * formatted, if name is null, or if name does not contain 0N/A * the realm to use and the default realm is not specified 0N/A * in either a Kerberos configuration file or via the 0N/A * java.security.krb5.realm system property. 0N/A // Appends the default realm if it is missing 0N/A * Constructs a KerberosPrincipal from the provided string and 0N/A * name type input. The string is assumed to contain a name in the 0N/A * format that is specified in Section 2.1 (Mandatory Name Forms) of 0N/A * Valid name types are specified in Section 6.2 (Principal Names) of 0N/A * The input name must be consistent with the provided name type. 0N/A * (for example, <i>duke@FOO.COM</i>, is a valid input string for the 0N/A * name type, KRB_NT_PRINCIPAL where <i>duke</i> 0N/A * represents a principal, and <i>FOO.COM</i> represents a realm). 0N/A * <p> If the input name does not contain a realm, the default realm 0N/A * is used. The default realm can be specified either in a Kerberos 0N/A * configuration file or via the java.security.krb5.realm 0N/A * system property. For more information, see 0N/A * Kerberos Requirements</a>. 0N/A * @param name the principal name 0N/A * @param nameType the name type of the principal 0N/A * @throws IllegalArgumentException if name is improperly 0N/A * formatted, if name is null, if the nameType is not supported, 0N/A * or if name does not contain the realm to use and the default 0N/A * realm is not specified in either a Kerberos configuration 0N/A * file or via the java.security.krb5.realm system property. 0N/A // Appends the default realm if it is missing 0N/A * Returns the realm component of this Kerberos principal. 0N/A * @return the realm component of this Kerberos principal. 0N/A * Returns a hashcode for this principal. The hash code is defined to 0N/A * be the result of the following calculation: 0N/A * hashCode = getName().hashCode(); 0N/A * @return a hashCode() for the <code>KerberosPrincipal</code> 0N/A * Compares the specified Object with this Principal for equality. 0N/A * Returns true if the given object is also a 0N/A * <code>KerberosPrincipal</code> and the two 0N/A * <code>KerberosPrincipal</code> instances are equivalent. 0N/A * More formally two <code>KerberosPrincipal</code> instances are equal 0N/A * if the values returned by <code>getName()</code> are equal and the 0N/A * values returned by <code>getNameType()</code> are equal. 0N/A * @param other the Object to compare to 0N/A * @return true if the Object passed in represents the same principal 0N/A * as this one, false otherwise. 0N/A * Save the KerberosPrincipal object to a stream 0N/A * @serialData this <code>KerberosPrincipal</code> is serialized 0N/A * by writing out the PrincipalName and the 0N/A * realm in their DER-encoded form as specified in Section 5.2.2 of 0N/A * Reads this object from a stream (i.e., deserializes it) 0N/A * The returned string corresponds to the single-string 0N/A * representation of a Kerberos Principal name as specified in 0N/A * @return the principal name. 0N/A * Returns the name type of the KerberosPrincipal. Valid name types 0N/A * are specified in Section 6.2 of 0N/A * @return the name type. 0N/A // Inherits javadocs from Object