com.sun.gssapi
Class GSSName
public class GSSName
extends java.lang.Object
An object of this class encapsulates a single GSS-API principal entity.
Different name formats and their definitions are identified with
universal Object Identifiers (Oids). The format of the names can be
derived based on the unique oid of each name type.
JGSS distinguishes between the following name representations:
- Internal Form
- A name representation which may contain name elements
from different mechanisms.
- Mechanism Name (MN)
- A name representation containing one and only one
mechanism name element.
- Flat Name
- A contiguous octet stream representation of a MN.
- RFC 2078
- gss_compare_name
- gss_display_name
- gss_import_name
- gss_release_name
static Oid | NT_ANONYMOUS - Name type used to represent an Anonymous identity.
|
static Oid | NT_EXPORT_NAME - Name type used to indicate an exported name produced by the
export method.
|
static Oid | NT_HOSTBASED_SERVICE - Name type used to indicate a host-based service name form.
|
static Oid | NT_MACHINE_UID_NAME - Name type used to indicate a numeric user identifier corresponding
to a user on a local system.
|
static Oid | NT_STRING_UID_NAME - Name type used to indicate a string of digits representing the
numeric user identifier of a user on a local system.
|
static Oid | NT_USER_NAME - Name type used to indicate a named user on a local system.
|
GSSName(String nameStr, Oid type) - Converts a contiguous string name to a GSSName object
of the specified type.
|
GSSName(String nameStr, Oid nameType, Oid mechType) - Creates a new GSSName object of the specified type.
|
GSSName(byte[] name, Oid type) - Creates a new GSSName object from the specified type.
|
GSSName(byte[] name, Oid nameType, Oid mechType) - Creates a new GSSName object from the specified type.
|
GSSName | canonicalize(Oid mechOid) - Creates a new name which is guaranteed to be mechanism specific (MN).
|
Object | clone() - Creates a duplicate of this object.
|
boolean | equals(Object another) - Compares this name with the specified GSSName for equality.
|
boolean | equals(GSSName another) - A variation of equals method which may throw a GSSException
when the names cannot be compared.
|
byte[] | export() - Returns a flat name representation for this GSSName object.
|
Oid | getStringNameType() - Returns the name type for the printed name.
|
boolean | isAnonymousName() - Tests if this is an Anonymous name object.
|
String | toString() - Returns a string representation of the GSSName object.
|
NT_ANONYMOUS
public static final Oid NT_ANONYMOUS
Name type used to represent an Anonymous identity. It represents
the following value:
{ 1(iso), 3(org), 6(dod), 1(internet), 5(security), 6(nametypes),
3(gss-anonymous-name) }
NT_EXPORT_NAME
public static final Oid NT_EXPORT_NAME
Name type used to indicate an exported name produced by the
export method. It represents the following value:
{ 1(iso), 3(org), 6(dod), 1(internet), 5(security), 6(nametypes),
4(gss-api-exported-name) }
NT_HOSTBASED_SERVICE
public static final Oid NT_HOSTBASED_SERVICE
Name type used to indicate a host-based service name form. It
is used to represent services associated with host computers.
This name form is constructed using two elements, "service" and
"hostname", as follows: service@hostname
Values for the "service" element are registered with the IANA.
It represents the following value:
{ 1(iso), 3(org), 6(dod), 1(internet), 5(security),
6(nametypes), 2(gss-host-based-services) }
NT_MACHINE_UID_NAME
public static final Oid NT_MACHINE_UID_NAME
Name type used to indicate a numeric user identifier corresponding
to a user on a local system. (e.g. Uid). It represents the
following value:
{ iso(1) member-body(2) United States(840) mit(113554) infosys(1)
gssapi(2) generic(1) machine_uid_name(2) }
NT_STRING_UID_NAME
public static final Oid NT_STRING_UID_NAME
Name type used to indicate a string of digits representing the
numeric user identifier of a user on a local system. It
represents the following value:
{ iso(1) member-body(2) United States(840) mit(113554) infosys(1)
gssapi(2) generic(1) string_uid_name(3) }
NT_USER_NAME
public static final Oid NT_USER_NAME
Name type used to indicate a named user on a local system. It
represents the following value:
{ iso(1) member-body(2) United States(840) mit(113554)
infosys(1) gssapi(2) generic(1) user_name(1) }
GSSName
public GSSName(String nameStr,
Oid type)
Converts a contiguous string name to a GSSName object
of the specified type. The nameStr parameter is
interpreted based on the type specified.
In general, the GSSName object created will not be an MN;
the exception to this is if the type parameter indicates
NT_EXPORT_NAME.
- RFC 2078
nameStr
- the name to createtype
- an oid specifying the name type
GSSName
public GSSName(String nameStr,
Oid nameType,
Oid mechType)
throws GSSException
Creates a new GSSName object of the specified type.
This constructor takes an additional mechanism oid parameter
which allows the creation of a mechanism name in one step.
- RFC 2078
nameStr
- the name to createnameType
- an oid specifying the name typemechType
- the oid of the mechanism to create this name for
GSSException
- with possible major codes of
BAD_NAMETYPE, BAD_NAME, or FAILURE.
GSSName
public GSSName(byte[] name,
Oid type)
throws GSSException
Creates a new GSSName object from the specified type. It
is envisioned that this constructor will be called with
buffers returned from GSSName.export() or for name types
that aren't represented by printable strings.
- RFC 2078
name
- buffer containing nametype
- an Oid specifying the name type
GSSException
- with possible major codes of
BAD_NAMETYPE, BAD_NAME, or FAILURE.
GSSName
public GSSName(byte[] name,
Oid nameType,
Oid mechType)
throws GSSException
Creates a new GSSName object from the specified type. It
is envisioned that this constructor will be called with
buffers returned from GSSName.export() or for name types
that aren't represented by printable strings. This constructor
takes an additional parameter for the mechanism oid.
- RFC 2078
name
- buffer containing namenameType
- an Oid specifying the name typemechType
- an Oid for the mechanism to create this name for
GSSException
- with possible major codes of
BAD_NAMETYPE, BAD_NAME, or FAILURE.
canonicalize
public GSSName canonicalize(Oid mechOid)
throws GSSException
Creates a new name which is guaranteed to be mechanism specific (MN).
- RFC 2078
mechOid
- oid of the mechanism for which the name should be
canonicalized
- a mechanism specific internal name (MN)
GSSException
- with possible major codes of
BAD_MECH, BAD_NAMETYPE.
clone
public Object clone()
throws CloneNotSupportedException
Creates a duplicate of this object.
- RFC 2078
equals
public boolean equals(Object another)
Compares this name with the specified GSSName for equality.
If either of the names has type NT_ANONYMOUS, this call will
return false.
- RFC 2078
another
- the GSSName object to be compared
- true if they both names refer to the same entity, false
otherwise
equals
public boolean equals(GSSName another)
throws GSSException
A variation of equals method which may throw a GSSException
when the names cannot be compared. If either of the names
represents an anonymous entity, the method will return false.
- RFC 2078
another
- GSSName object to be compared
- true if they both names refer to the same entity, false
otherwise
GSSException
- with possible major codes of
BAD_NAMETYPE, BAD_NAME, FAILURE
export
public byte[] export()
throws GSSException
Returns a flat name representation for this GSSName object. The
name must be in MN format before making this call. The name is
prefixed with a mechanism independent header as specified in
RFC 2078. The returned buffer can be passed into a GSSName
constructor with GSSName.EXPORT_NAME as the name type.
- RFC 2078
- a byte array representing the name
GSSException
- with possible major codes of NAME_NOT_MN,
BAD_NAME, BAD_NAMETYPE, FAILURE.
getStringNameType
public Oid getStringNameType()
throws GSSException
Returns the name type for the printed name.
- RFC 2078
- Oid for the name type as printed with toString()
isAnonymousName
public boolean isAnonymousName()
Tests if this is an Anonymous name object.
- boolean indicating if this in an anonymous name
toString
public String toString()
Returns a string representation of the GSSName object.
To retrieve the printed name format call getStringNameType.
- a String representation for this GSSName