001: /*
002: * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package sun.security.jgss.spi;
027:
028: import org.ietf.jgss.*;
029: import java.security.Provider;
030:
031: /**
032: * This interface is implemented by a mechanism specific name element. A
033: * GSSName is conceptually a container class of several name elements from
034: * different mechanisms.
035: *
036: * @author Mayank Upadhyay
037: * @version 1.13, 05/05/07
038: */
039:
040: public interface GSSNameSpi {
041:
042: public Provider getProvider();
043:
044: /**
045: * Equals method for the GSSNameSpi objects.
046: * If either name denotes an anonymous principal, the call should
047: * return false.
048: *
049: * @param name to be compared with
050: * @returns true if they both refer to the same entity, else false
051: * @exception GSSException with major codes of BAD_NAMETYPE,
052: * BAD_NAME, FAILURE
053: */
054: public boolean equals(GSSNameSpi name) throws GSSException;
055:
056: /**
057: * Compares this <code>GSSNameSpi</code> object to another Object
058: * that might be a <code>GSSNameSpi</code>. The behaviour is exactly
059: * the same as in {@link #equals(GSSNameSpi) equals} except that
060: * no GSSException is thrown; instead, false will be returned in the
061: * situation where an error occurs.
062: *
063: * @param another the object to be compared to
064: * @returns true if they both refer to the same entity, else false
065: * @see #equals(GSSNameSpi)
066: */
067: public boolean equals(Object another);
068:
069: /**
070: * Returns a hashcode value for this GSSNameSpi.
071: *
072: * @return a hashCode value
073: */
074: public int hashCode();
075:
076: /**
077: * Returns a flat name representation for this object. The name
078: * format is defined in RFC 2078.
079: *
080: * @return the flat name representation for this object
081: * @exception GSSException with major codes NAME_NOT_MN, BAD_NAME,
082: * BAD_NAME, FAILURE.
083: */
084: public byte[] export() throws GSSException;
085:
086: /**
087: * Get the mechanism type that this NameElement corresponds to.
088: *
089: * @return the Oid of the mechanism type
090: */
091: public Oid getMechanism();
092:
093: /**
094: * Returns a string representation for this name. The printed
095: * name type can be obtained by calling getStringNameType().
096: *
097: * @return string form of this name
098: * @see #getStringNameType()
099: * @overrides Object#toString
100: */
101: public String toString();
102:
103: /**
104: * Returns the oid describing the format of the printable name.
105: *
106: * @return the Oid for the format of the printed name
107: */
108: public Oid getStringNameType();
109:
110: /**
111: * Indicates if this name object represents an Anonymous name.
112: */
113: public boolean isAnonymousName();
114: }
|