net.sourceforge.spnego
Class SpnegoPrincipal

java.lang.Object
  extended by net.sourceforge.spnego.SpnegoPrincipal
All Implemented Interfaces:
Principal

public final class SpnegoPrincipal
extends Object
implements Principal

This class encapsulates a KerberosPrincipal.

This class also has a reference to the client's/requester's delegated credential (if any). See the DelegateServletRequest documentation for more details.

Also, see the delegation examples at http://spnego.sourceforge.net

Author:
Darwin V. Felix

Field Summary
private  GSSCredential delegatedCred
           
private  KerberosPrincipal kerberosPrincipal
           
 
Constructor Summary
SpnegoPrincipal(String name)
          Constructs a SpnegoPrincipal from the provided String input.
SpnegoPrincipal(String name, int nameType)
          Constructs a SpnegoPrincipal from the provided String input and name type input.
SpnegoPrincipal(String name, int nameType, GSSCredential delegCred)
          Constructs a SpnegoPrincipal from the provided String input and name type input.
 
Method Summary
 GSSCredential getDelegatedCredential()
          Returns this Principal's delegated credential or null.
 String getName()
           
 int getNameType()
          Returns the name type of the KerberosPrincipal.
 String getRealm()
          Returns the realm component of this Kerberos principal.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals
 

Field Detail

kerberosPrincipal

private final transient KerberosPrincipal kerberosPrincipal

delegatedCred

private final transient GSSCredential delegatedCred
Constructor Detail

SpnegoPrincipal

public SpnegoPrincipal(String name)
Constructs a SpnegoPrincipal from the provided String input.

Parameters:
name - the principal name

SpnegoPrincipal

public SpnegoPrincipal(String name,
                       int nameType)
Constructs a SpnegoPrincipal from the provided String input and name type input.

Parameters:
name - the principal name
nameType - the name type of the principal

SpnegoPrincipal

public SpnegoPrincipal(String name,
                       int nameType,
                       GSSCredential delegCred)
Constructs a SpnegoPrincipal from the provided String input and name type input.

Parameters:
name - the principal name
nameType - the name type of the principal
delegCred - this principal's delegated credential (if any)
Method Detail

getDelegatedCredential

public GSSCredential getDelegatedCredential()
Returns this Principal's delegated credential or null.

Returns:
Principal's delegated credential or null.

getName

public String getName()
Specified by:
getName in interface Principal

getNameType

public int getNameType()
Returns the name type of the KerberosPrincipal.

Returns:
name type of the KerberosPrincipal

getRealm

public String getRealm()
Returns the realm component of this Kerberos principal.

Returns:
realm component of this Kerberos principal

hashCode

public int hashCode()
Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object

toString

public String toString()
Specified by:
toString in interface Principal
Overrides:
toString in class Object