Package com.ongres.scram.client
Class ServerFirstProcessor
- java.lang.Object
-
- com.ongres.scram.client.ServerFirstProcessor
-
final class ServerFirstProcessor extends java.lang.Object
Process a received server-first-message. Generate by callingScramClient#receiveServerFirstMessage(String)
.
-
-
Field Summary
Fields Modifier and Type Field Description private ClientFirstMessage
clientFirstMessage
private ScramMechanism
scramMechanism
private ServerFirstMessage
serverFirstMessage
private StringPreparation
stringPreparation
-
Constructor Summary
Constructors Constructor Description ServerFirstProcessor(ScramMechanism scramMechanism, StringPreparation stringPreparation, @NotNull java.lang.String receivedServerFirstMessage, @NotNull java.lang.String nonce, @NotNull ClientFirstMessage clientFirstMessage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ClientFinalProcessor
clientFinalProcessor(byte[] saltedPassword)
Generates aClientFinalProcessor
, that allows to generate the client-final-message and also receive and parse the server-first-message.(package private) ClientFinalProcessor
clientFinalProcessor(byte[] clientKey, byte[] serverKey)
Generates aClientFinalProcessor
, that allows to generate the client-final-message and also receive and parse the server-first-message.(package private) ClientFinalProcessor
clientFinalProcessor(char[] password)
Generates aClientFinalProcessor
, that allows to generate the client-final-message and also receive and parse the server-first-message.(package private) @NotNull ServerFirstMessage
getServerFirstMessage()
-
-
-
Field Detail
-
scramMechanism
private final ScramMechanism scramMechanism
-
stringPreparation
private final StringPreparation stringPreparation
-
clientFirstMessage
private final ClientFirstMessage clientFirstMessage
-
serverFirstMessage
private final ServerFirstMessage serverFirstMessage
-
-
Constructor Detail
-
ServerFirstProcessor
ServerFirstProcessor(ScramMechanism scramMechanism, StringPreparation stringPreparation, @NotNull @NotNull java.lang.String receivedServerFirstMessage, @NotNull @NotNull java.lang.String nonce, @NotNull @NotNull ClientFirstMessage clientFirstMessage) throws ScramParseException
- Throws:
ScramParseException
-
-
Method Detail
-
getServerFirstMessage
@NotNull @NotNull ServerFirstMessage getServerFirstMessage()
-
clientFinalProcessor
ClientFinalProcessor clientFinalProcessor(char[] password)
Generates aClientFinalProcessor
, that allows to generate the client-final-message and also receive and parse the server-first-message. It is based on the user's password.- Parameters:
password
- The user's password- Returns:
- The handler
- Throws:
java.lang.IllegalArgumentException
- If the message is null or empty
-
clientFinalProcessor
ClientFinalProcessor clientFinalProcessor(byte[] clientKey, byte[] serverKey)
Generates aClientFinalProcessor
, that allows to generate the client-final-message and also receive and parse the server-first-message. It is based on the clientKey and serverKey, which, if available, provide an optimized path versus providing the original user's password.- Parameters:
clientKey
- The client key, as per the SCRAM algorithm. It can be generated with:ScramFunctions.clientKey(ScramMechanism, byte[])
serverKey
- The server key, as per the SCRAM algorithm. It can be generated with:ScramFunctions.serverKey(ScramMechanism, byte[])
- Returns:
- The handler
- Throws:
java.lang.IllegalArgumentException
- If the clientKey/serverKey is null
-
clientFinalProcessor
ClientFinalProcessor clientFinalProcessor(byte[] saltedPassword)
Generates aClientFinalProcessor
, that allows to generate the client-final-message and also receive and parse the server-first-message. It is based on the saltedPassword, which, if available, provide an optimized path versus providing the original user's password.- Parameters:
saltedPassword
- The salted password, as per the SCRAM algorithm. It can be generated with:ScramFunctions.saltedPassword(ScramMechanism, StringPreparation, char[], byte[], int)
- Returns:
- The handler
- Throws:
java.lang.IllegalArgumentException
- If the saltedPassword is null
-
-