Enum Class ScramAttributes

java.lang.Object
java.lang.Enum<ScramAttributes>
com.ongres.scram.common.ScramAttributes
All Implemented Interfaces:
CharAttribute, Serializable, Comparable<ScramAttributes>, Constable

public enum ScramAttributes extends Enum<ScramAttributes> implements CharAttribute
SCRAM Attributes as defined in Section 5.1 of the RFC. Not all the available attributes may be available in this implementation.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    This is an optional attribute, and is part of the GS2 [RFC5801] bridge between the GSS-API and SASL.
    This REQUIRED attribute specifies the base64-encoded GS2 header and channel binding data.
    This attribute specifies a base64-encoded ClientProof.
    This attribute specifies an error that occurred during authentication exchange.
    This attribute specifies an iteration count for the selected hash function and user.
    This attribute specifies a sequence of random printable ASCII characters excluding ',' (which forms the nonce used as input to the hash function).
    This attribute specifies the base64-encoded salt used by the server for this user.
    This attribute specifies a base64-encoded ServerSignature.
    This attribute specifies the name of the user whose password is used for authentication (a.k.a.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final char
     
    private static final Map<Character,ScramAttributes>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    ScramAttributes(char attributeChar)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byChar(char c)
    Find a SCRAMAttribute by its character.
    char
    Return the char used to represent this attribute
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • USERNAME

      public static final ScramAttributes USERNAME
      This attribute specifies the name of the user whose password is used for authentication (a.k.a. "authentication identity" [RFC4422]). If the "a" attribute is not specified (which would normally be the case), this username is also the identity that will be associated with the connection subsequent to authentication and authorization. The client SHOULD prepare the username using the "SASLprep" profile [RFC4013] of the "stringprep" algorithm [RFC3454] treating it as a query string (i.e., unassigned Unicode code points are allowed). The characters ',' or '=' in usernames are sent as '=2C' and '=3D' respectively.
    • AUTHZID

      public static final ScramAttributes AUTHZID
      This is an optional attribute, and is part of the GS2 [RFC5801] bridge between the GSS-API and SASL. This attribute specifies an authorization identity. A client may include it in its first message to the server if it wants to authenticate as one user, but subsequently act as a different user. This is typically used by an administrator to perform some management task on behalf of another user, or by a proxy in some situations. If this attribute is omitted (as it normally would be), the authorization identity is assumed to be derived from the username specified with the (required) "n" attribute. The server always authenticates the user specified by the "n" attribute. If the "a" attribute specifies a different user, the server associates that identity with the connection after successful authentication and authorization checks. The syntax of this field is the same as that of the "n" field with respect to quoting of '=' and ','.
    • NONCE

      public static final ScramAttributes NONCE
      This attribute specifies a sequence of random printable ASCII characters excluding ',' (which forms the nonce used as input to the hash function). No quoting is applied to this string.
    • CHANNEL_BINDING

      public static final ScramAttributes CHANNEL_BINDING
      This REQUIRED attribute specifies the base64-encoded GS2 header and channel binding data. The attribute data consist of:
      • the GS2 header from the client's first message (recall that the GS2 header contains a channel binding flag and an optional authzid). This header is going to include channel binding type prefix (see [RFC5056]), if and only if the client is using channel binding;
      • followed by the external channel's channel binding data, if and only if the client is using channel binding.
    • SALT

      public static final ScramAttributes SALT
      This attribute specifies the base64-encoded salt used by the server for this user.
    • ITERATION

      public static final ScramAttributes ITERATION
      This attribute specifies an iteration count for the selected hash function and user.
    • CLIENT_PROOF

      public static final ScramAttributes CLIENT_PROOF
      This attribute specifies a base64-encoded ClientProof.
    • SERVER_SIGNATURE

      public static final ScramAttributes SERVER_SIGNATURE
      This attribute specifies a base64-encoded ServerSignature.
    • ERROR

      public static final ScramAttributes ERROR
      This attribute specifies an error that occurred during authentication exchange. Can help diagnose the reason for the authentication exchange failure.
  • Field Details

    • attributeChar

      private final char attributeChar
    • REVERSE_MAPPING

      private static final Map<Character,ScramAttributes> REVERSE_MAPPING
  • Constructor Details

    • ScramAttributes

      private ScramAttributes(char attributeChar)
  • Method Details

    • values

      public static ScramAttributes[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ScramAttributes valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getChar

      public char getChar()
      Description copied from interface: CharAttribute
      Return the char used to represent this attribute
      Specified by:
      getChar in interface CharAttribute
      Returns:
      The character of the attribute
    • byChar

      public static ScramAttributes byChar(char c) throws ScramParseException
      Find a SCRAMAttribute by its character.
      Parameters:
      c - The character.
      Returns:
      The SCRAMAttribute that has that character.
      Throws:
      ScramParseException - If no SCRAMAttribute has this character.