APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.jgss.krb5

public Class Krb5NameElement

extends Object
implements GSSNameSpi
Class Inheritance
All Implemented Interfaces
sun.security.jgss.spi.GSSNameSpi
Imports
org.ietf.jgss.*, sun.security.jgss.spi.*, sun.security.krb5.PrincipalName, .KrbException, java.net.InetAddress, .UnknownHostException, java.security.Provider, java.util.Locale

Implements the GSSNameSpi for the krb5 mechanism.
Author
Mayank Upadhyay

Field Summary

Modifier and TypeField and Description
private final String
private final Oid
private final PrincipalName

Constructor Summary

AccessConstructor and Description
private
Krb5NameElement(PrincipalName principalName, String gssNameStr, Oid gssNameType)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if they both refer to the same entity, else false
equals
(GSSNameSpi
to be compared with
other
)

Implements sun.security.jgss.spi.GSSNameSpi.equals.

Equal method for the GSSNameSpi objects.

public boolean

Returns:

true if they both refer to the same entity, else false
equals
(Object
the object to be compared to
another
)

Overrides java.lang.Object.equals.

Implements sun.security.jgss.spi.GSSNameSpi.equals.

Compares this GSSNameSpi object to another Object that might be a GSSNameSpi.

public byte[]
export()

Implements sun.security.jgss.spi.GSSNameSpi.export.

Returns the principal name in the form user@REALM or host/service@REALM but with the following constraints that are imposed by RFC 1964:

 (1) all occurrences of the characters `@`,  `/`, and `\` within
  principal components or realm names shall be quoted with an
  immediately-preceding `\`.
private static String[]
getComponents(String gssNameStr)

public Oid
getGSSNameType()

Returns the name type oid.

private static String
getHostBasedInstance(String serviceName, String hostName)

pack-priv static Krb5NameElement
getInstance(String gssNameStr, Oid gssNameType)

Instantiates a new Krb5NameElement object.

public static Krb5NameElement
getInstance(PrincipalName principalName)

public final PrincipalName
public Oid

Returns:

the Oid of the mechanism type
getMechanism
()

Implements sun.security.jgss.spi.GSSNameSpi.getMechanism.

Get the mechanism type that this NameElement corresponds to.

public Provider
public Oid

Returns:

the Oid for the format of the printed name
getStringNameType
()

Implements sun.security.jgss.spi.GSSNameSpi.getStringNameType.

Returns the oid describing the format of the printable name.

public int

Returns:

a hashcode value for this GSSNameSpi
hashCode
()

Overrides java.lang.Object.hashCode.

Implements sun.security.jgss.spi.GSSNameSpi.hashCode.

Returns a hashcode value for this GSSNameSpi.

public boolean
isAnonymousName()

Implements sun.security.jgss.spi.GSSNameSpi.isAnonymousName.

Indicates if this name object represents an Anonymous name.

public String

Returns:

string form of this name
toString
()

Overrides java.lang.Object.toString.

Implements sun.security.jgss.spi.GSSNameSpi.toString.

Returns a string representation for this name.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

gssNameStrback to summary
private final String gssNameStr
gssNameTypeback to summary
private final Oid gssNameType
krb5PrincipalNameback to summary
private final PrincipalName krb5PrincipalName

Constructor Detail

Krb5NameElementback to summary
private Krb5NameElement(PrincipalName principalName, String gssNameStr, Oid gssNameType)

Method Detail

equalsback to summary
public boolean equals(GSSNameSpi other) throws GSSException

Implements sun.security.jgss.spi.GSSNameSpi.equals.

Equal method for the GSSNameSpi objects. If either name denotes an anonymous principal, the call should return false.

Parameters
other:GSSNameSpi

to be compared with

Returns:boolean

true if they both refer to the same entity, else false

Exceptions
GSSException:
with major codes of BAD_NAMETYPE, BAD_NAME, FAILURE
equalsback to summary
public boolean equals(Object another)

Overrides java.lang.Object.equals.

Implements sun.security.jgss.spi.GSSNameSpi.equals.

Compares this GSSNameSpi object to another Object that might be a GSSNameSpi. The behaviour is exactly the same as in equals except that no GSSException is thrown; instead, false will be returned in the situation where an error occurs.

Parameters
another:Object

the object to be compared to

Returns:boolean

true if they both refer to the same entity, else false

Annotations
@Override
See Also
equals(GSSNameSpi)
exportback to summary
public byte[] export() throws GSSException

Implements sun.security.jgss.spi.GSSNameSpi.export.

Returns the principal name in the form user@REALM or host/service@REALM but with the following constraints that are imposed by RFC 1964:

 (1) all occurrences of the characters `@`,  `/`, and `\` within
  principal components or realm names shall be quoted with an
  immediately-preceding `\`.

  (2) all occurrences of the null, backspace, tab, or newline
  characters within principal components or realm names will be
  represented, respectively, with `\0`, `\b`, `\t`, or `\n`.

  (3) the `\` quoting character shall not be emitted within an
  exported name except to accommodate cases (1) and (2).
Exceptions
GSSException:

Doc from sun.security.jgss.spi.GSSNameSpi.export.

with major codes NAME_NOT_MN, BAD_NAME, BAD_NAME, FAILURE.

getComponentsback to summary
private static String[] getComponents(String gssNameStr) throws GSSException
getGSSNameTypeback to summary
public Oid getGSSNameType()

Returns the name type oid.

getHostBasedInstanceback to summary
private static String getHostBasedInstance(String serviceName, String hostName) throws GSSException
getInstanceback to summary
pack-priv static Krb5NameElement getInstance(String gssNameStr, Oid gssNameType) throws GSSException

Instantiates a new Krb5NameElement object. Internally it stores the information provided by the input parameters so that they may later be used for output when a printable representation of this name is needed in GSS-API format rather than in Kerberos format.

getInstanceback to summary
public static Krb5NameElement getInstance(PrincipalName principalName)
getKrb5PrincipalNameback to summary
public final PrincipalName getKrb5PrincipalName()
getMechanismback to summary
public Oid getMechanism()

Implements sun.security.jgss.spi.GSSNameSpi.getMechanism.

Get the mechanism type that this NameElement corresponds to.

Returns:Oid

the Oid of the mechanism type

getProviderback to summary
public Provider getProvider()

Implements sun.security.jgss.spi.GSSNameSpi.getProvider.

getStringNameTypeback to summary
public Oid getStringNameType()

Implements sun.security.jgss.spi.GSSNameSpi.getStringNameType.

Returns the oid describing the format of the printable name.

Returns:Oid

the Oid for the format of the printed name

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements sun.security.jgss.spi.GSSNameSpi.hashCode.

Returns a hashcode value for this GSSNameSpi.

Returns:int

a hashcode value for this GSSNameSpi

Annotations
@Override
isAnonymousNameback to summary
public boolean isAnonymousName()

Implements sun.security.jgss.spi.GSSNameSpi.isAnonymousName.

Indicates if this name object represents an Anonymous name.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements sun.security.jgss.spi.GSSNameSpi.toString.

Returns a string representation for this name. The printed name type can be obtained by calling getStringNameType().

Returns:String

string form of this name

See Also
getStringNameType()