Class ClientFirstMessage

java.lang.Object
com.ongres.scram.common.message.ClientFirstMessage
All Implemented Interfaces:
StringWritable

public class ClientFirstMessage extends Object implements StringWritable
Constructs and parses client-first-messages. Message contains a Gs2Header, a username and a nonce. Formal syntax is: client-first-message-bare = [reserved-mext ","] username "," nonce ["," extensions] client-first-message = gs2-header client-first-message-bare Note that extensions are not supported.
See Also:
  • Field Details

    • gs2Header

      private final Gs2Header gs2Header
    • user

      private final String user
    • nonce

      private final String nonce
  • Constructor Details

    • ClientFirstMessage

      public ClientFirstMessage(Gs2Header gs2Header, String user, String nonce) throws IllegalArgumentException
      Constructs a client-first-message for the given user, nonce and gs2Header. This constructor is intended to be instantiated by a scram client, and not directly. The client should be providing the header, and nonce (and probably the user too).
      Parameters:
      gs2Header - The GSS-API header
      user - The SCRAM user
      nonce - The nonce for this session
      Throws:
      IllegalArgumentException - If any of the arguments is null or empty
    • ClientFirstMessage

      public ClientFirstMessage(Gs2CbindFlag gs2CbindFlag, String authzid, String cbindName, String user, String nonce)
      Constructs a client-first-message for the given parameters. Under normal operation, this constructor is intended to be instantiated by a scram client, and not directly. However, this constructor is more user- or test-friendly, as the arguments are easier to provide without building other indirect object parameters.
      Parameters:
      gs2CbindFlag - The channel-binding flag
      authzid - The optional authzid
      cbindName - The optional channel binding name
      user - The SCRAM user
      nonce - The nonce for this session
      Throws:
      IllegalArgumentException - If the flag, user or nonce are null or empty
    • ClientFirstMessage

      public ClientFirstMessage(String user, String nonce)
      Constructs a client-first-message for the given parameters, with no channel binding nor authzid. Under normal operation, this constructor is intended to be instantiated by a scram client, and not directly. However, this constructor is more user- or test-friendly, as the arguments are easier to provide without building other indirect object parameters.
      Parameters:
      user - The SCRAM user
      nonce - The nonce for this session
      Throws:
      IllegalArgumentException - If the user or nonce are null or empty
  • Method Details