public class ClientFirstMessage extends java.lang.Object implements StringWritable
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.Modifier and Type | Field and Description |
---|---|
private Gs2Header |
gs2Header |
private java.lang.String |
nonce |
private java.lang.String |
user |
Constructor and Description |
---|
ClientFirstMessage(Gs2CbindFlag gs2CbindFlag,
java.lang.String authzid,
java.lang.String cbindName,
java.lang.String user,
java.lang.String nonce)
Constructs a client-first-message for the given parameters.
|
ClientFirstMessage(Gs2Header gs2Header,
java.lang.String user,
java.lang.String nonce)
Constructs a client-first-message for the given user, nonce and gs2Header.
|
ClientFirstMessage(java.lang.String user,
java.lang.String nonce)
Constructs a client-first-message for the given parameters, with no channel binding nor authzid.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthzid() |
Gs2CbindFlag |
getChannelBindingFlag() |
java.lang.String |
getChannelBindingName() |
Gs2Header |
getGs2Header() |
java.lang.String |
getNonce() |
java.lang.String |
getUser() |
private static Gs2Header |
gs2Header(Gs2CbindFlag gs2CbindFlag,
java.lang.String authzid,
java.lang.String cbindName) |
boolean |
isChannelBinding() |
static ClientFirstMessage |
parseFrom(java.lang.String clientFirstMessage)
Construct a
ClientFirstMessage instance from a message (String) |
java.lang.String |
toString() |
java.lang.StringBuffer |
writeTo(java.lang.StringBuffer sb)
Write the class information to the given StringBuffer.
|
java.lang.StringBuffer |
writeToWithoutGs2Header(java.lang.StringBuffer sb)
Limited version of the
Object.toString() method, that doesn't write the GS2 header. |
private final Gs2Header gs2Header
private final java.lang.String user
private final java.lang.String nonce
public ClientFirstMessage(Gs2Header gs2Header, java.lang.String user, java.lang.String nonce) throws java.lang.IllegalArgumentException
gs2Header
- The GSS-API headeruser
- The SCRAM usernonce
- The nonce for this sessionjava.lang.IllegalArgumentException
- If any of the arguments is null or emptypublic ClientFirstMessage(Gs2CbindFlag gs2CbindFlag, java.lang.String authzid, java.lang.String cbindName, java.lang.String user, java.lang.String nonce)
gs2CbindFlag
- The channel-binding flagauthzid
- The optional authzidcbindName
- The optional channel binding nameuser
- The SCRAM usernonce
- The nonce for this sessionjava.lang.IllegalArgumentException
- If the flag, user or nonce are null or emptypublic ClientFirstMessage(java.lang.String user, java.lang.String nonce)
user
- The SCRAM usernonce
- The nonce for this sessionjava.lang.IllegalArgumentException
- If the user or nonce are null or emptyprivate static Gs2Header gs2Header(Gs2CbindFlag gs2CbindFlag, java.lang.String authzid, java.lang.String cbindName)
public Gs2CbindFlag getChannelBindingFlag()
public boolean isChannelBinding()
public java.lang.String getChannelBindingName()
public java.lang.String getAuthzid()
public Gs2Header getGs2Header()
public java.lang.String getUser()
public java.lang.String getNonce()
public java.lang.StringBuffer writeToWithoutGs2Header(java.lang.StringBuffer sb)
Object.toString()
method, that doesn't write the GS2 header.
This method is useful to construct the auth message used as part of the SCRAM algorithm.sb
- A StringBuffer where to write the data to.public java.lang.StringBuffer writeTo(java.lang.StringBuffer sb)
StringWritable
writeTo
in interface StringWritable
sb
- Where to write the data.public static ClientFirstMessage parseFrom(java.lang.String clientFirstMessage) throws ScramParseException, java.lang.IllegalArgumentException
ClientFirstMessage
instance from a message (String)clientFirstMessage
- The String representing the client-first-messageScramParseException
- If the message is not a valid client-first-messagejava.lang.IllegalArgumentException
- If the message is null or emptypublic java.lang.String toString()
toString
in class java.lang.Object