Package com.ongres.scram.common
Class ServerFinalMessage
java.lang.Object
com.ongres.scram.common.ServerFinalMessage
Constructs and parses
server-final-messages.
| server-error | "e=" server-error-value |
| server-error-value | "invalid-encoding" / "extensions-not-supported" / ; unrecognized 'm' value "invalid-proof" / "channel-bindings-dont-match" / "server-does-support-channel-binding" / ; server does not support channel binding "channel-binding-not-supported" / "unsupported-channel-binding-type" / "unknown-user" / "invalid-username-encoding" / ; invalid username encoding (invalid UTF-8 or ; SASLprep failed) "no-resources" / "other-error" ; Unrecognized errors should be treated as "other-error". ; In order to prevent information disclosure, the server ; may substitute the real reason with "other-error". |
| verifier | "v=" base64 ;; base-64 encoded ServerSignature. |
| server-final-message | (server-error / verifier) ["," extensions] |
- See Also:
- Implementation Note:
extensionsare not supported.
-
Constructor Summary
ConstructorsConstructorDescriptionServerFinalMessage(byte @NotNull [] verifier) Constructs a server-final-message with no errors, and the provided server verifier.ServerFinalMessage(@NotNull String serverError) Constructs a server-final-message which represents a SCRAM error. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringGet the server-error-value from the "e=" server-final-message.byte @Nullable []Get the verifier value from the "v=" server-final-message.booleanisError()Whether this server-final-message contains an error.static @NotNull ServerFinalMessageParses a server-final-message from a String.final @NotNull StringtoString()String representation of the SCRAM message.
-
Constructor Details
-
ServerFinalMessage
public ServerFinalMessage(byte @NotNull [] verifier) Constructs a server-final-message with no errors, and the provided server verifier.- Parameters:
verifier- The bytes of the computed signature- Throws:
IllegalArgumentException- If the verifier is null
-
ServerFinalMessage
Constructs a server-final-message which represents a SCRAM error.- Parameters:
serverError- The error message- Throws:
IllegalArgumentException- If the error is null
-
-
Method Details
-
isError
public boolean isError()Whether this server-final-message contains an error.- Returns:
- True if it contains an error, false if it contains a verifier
-
getVerifier
public byte @Nullable [] getVerifier()Get the verifier value from the "v=" server-final-message.- Returns:
- the
verifier
-
getServerError
Get the server-error-value from the "e=" server-final-message.- Returns:
- the
server-error-value
-
parseFrom
@NotNull public static @NotNull ServerFinalMessage parseFrom(@NotNull @NotNull String serverFinalMessage) throws ScramParseException Parses a server-final-message from a String.- Parameters:
serverFinalMessage- The message- Returns:
- A constructed server-final-message instance
- Throws:
ScramParseException- If the argument is not a valid server-final-messageIllegalArgumentException- If the message is null or empty
-
toString
String representation of the SCRAM message.
-