public class ClientFirstMessage extends 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.Constructor and Description |
---|
ClientFirstMessage(Gs2CbindFlag gs2CbindFlag,
String authzid,
String cbindName,
String user,
String nonce)
Constructs a client-first-message for the given parameters.
|
ClientFirstMessage(Gs2Header gs2Header,
String user,
String nonce)
Constructs a client-first-message for the given user, nonce and gs2Header.
|
ClientFirstMessage(String user,
String nonce)
Constructs a client-first-message for the given parameters, with no channel binding nor authzid.
|
Modifier and Type | Method and Description |
---|---|
Optional<String> |
getAuthzid() |
Gs2CbindFlag |
getChannelBindingFlag() |
Optional<String> |
getChannelBindingName() |
Gs2Header |
getGs2Header() |
String |
getNonce() |
String |
getUser() |
boolean |
isChannelBinding() |
static ClientFirstMessage |
parseFrom(String clientFirstMessage)
Construct a
ClientFirstMessage instance from a message (String) |
String |
toString() |
StringBuffer |
writeTo(StringBuffer sb)
Write the class information to the given StringBuffer.
|
StringBuffer |
writeToWithoutGs2Header(StringBuffer sb)
Limited version of the
Object.toString() method, that doesn't write the GS2 header. |
public ClientFirstMessage(Gs2Header gs2Header, String user, String nonce) throws IllegalArgumentException
gs2Header
- The GSS-API headeruser
- The SCRAM usernonce
- The nonce for this sessionIllegalArgumentException
- If any of the arguments is null or emptypublic ClientFirstMessage(Gs2CbindFlag gs2CbindFlag, String authzid, String cbindName, String user, String nonce)
gs2CbindFlag
- The channel-binding flagauthzid
- The optional authzidcbindName
- The optional channel binding nameuser
- The SCRAM usernonce
- The nonce for this sessionIllegalArgumentException
- If the flag, user or nonce are null or emptypublic ClientFirstMessage(String user, String nonce)
user
- The SCRAM usernonce
- The nonce for this sessionIllegalArgumentException
- If the user or nonce are null or emptypublic Gs2CbindFlag getChannelBindingFlag()
public boolean isChannelBinding()
public Gs2Header getGs2Header()
public String getUser()
public String getNonce()
public StringBuffer writeToWithoutGs2Header(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 StringBuffer writeTo(StringBuffer sb)
StringWritable
writeTo
in interface StringWritable
sb
- Where to write the data.public static ClientFirstMessage parseFrom(String clientFirstMessage) throws ScramParseException, IllegalArgumentException
ClientFirstMessage
instance from a message (String)clientFirstMessage
- The String representing the client-first-messageScramParseException
- If the message is not a valid client-first-messageIllegalArgumentException
- If the message is null or emptyCopyright © 2017–2021. All rights reserved.