Package org.silverpeas.sso.kerberos.spnego

## Class SpnegoPrincipal

- java.lang.Object
- - org.silverpeas.sso.kerberos.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

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object o)` |
    `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, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.security.Principal

      `implies`

- - ### Constructor Detail

    - #### 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`

    - #### equals

          public boolean equals​(Object o)

      Specified by:
        `equals` in interface `Principal`
      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Specified by:
        `toString` in interface `Principal`
      Overrides:
        `toString` in class `Object`