Class AuthzId

All Implemented Interfaces:
Identifier, Comparable<Identifier>, net.minidev.json.JSONAware

public final class AuthzId extends BaseIdentifier
Represents a SASL authorisation identity, as specified in RFC 4513, section 5.2.1.8. This can be a distinguished name (DN) or a username.

Note that for the purpose of keying and comparing authorisation identities, the DNs are normalised and the usernames are converted to lower case.

DN form:

 "dn: uid=alice,ou=people,dc=wonderland,dc=net"
 

Username form:

 "u: alice"
 
  • Field Details

  • Constructor Details

    • AuthzId

      public AuthzId(com.unboundid.ldap.sdk.DN dn)
      Creates a new authorisation identity from the specified DN.

      Note that for the purpose of keying and comparing authorisation IDs, the DN will be normalised (simple normalisation, without consulting the schema).

      Parameters:
      dn - The DN, must not be null. If DN.NULL_DN indicates an anonymous user.
    • AuthzId

      public AuthzId(Username username)
      Creates a new authorisation identity from the specified username.

      Note that for the purpose of keying and comparing authorisation IDs, the username will be converted to lower case.

      Parameters:
      username - The username, must not be null. If empty indicates an anonymous user.
  • Method Details

    • parse

      public static AuthzId parse(String value) throws ParseException
      Parses a string representation of a SASL authorisation identity.
      Parameters:
      value - The string to parse, if null or empty ANONYMOUS is returned.
      Returns:
      The parsed authorisation identity.
      Throws:
      ParseException - On a bad authzid syntax.
    • getIdentityType

      Gets the identity type.
      Returns:
      The identity type.
    • getDN

      public com.unboundid.ldap.sdk.DN getDN()
      Gets the identity DN.
      Returns:
      The DN, null if specified as a username instead.
    • getUsername

      Gets the identity username.
      Returns:
      The username, null if specified as a DN instead.
    • equals

      public boolean equals(Object object)
      Description copied from class: BaseIdentifier
      Overrides Object.equals().
      Specified by:
      equals in class BaseIdentifier
      Parameters:
      object - The object to compare to.
      Returns:
      true if the objects have the same value, otherwise false.