Package com.ongres.scram.client
Class ScramSession
- java.lang.Object
-
- com.ongres.scram.client.ScramSession
-
public class ScramSession extends Object
A class that represents a SCRAM client. Use this class to perform a SCRAM negotiation with a SCRAM server. This class performs an authentication execution for a given user, and has state related to it. Thus, it cannot be shared across users or authentication executions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classScramSession.ClientFinalProcessorProcessor that allows to generate the client-final-message, as well as process the server-final-message and verify server's signature.classScramSession.ServerFirstProcessorProcess a received server-first-message.
-
Constructor Summary
Constructors Constructor Description ScramSession(com.ongres.scram.common.ScramMechanism scramMechanism, com.ongres.scram.common.stringprep.StringPreparation stringPreparation, String user, String nonce)Constructs a SCRAM client, to perform an authentication for a given user.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringclientFirstMessage()Returns the text representation of a SCRAM client-first-message, with no channel binding nor authzid.StringclientFirstMessage(com.ongres.scram.common.gssapi.Gs2CbindFlag gs2CbindFlag, String cbindName, String authzid)Returns the text representation of a SCRAM client-first-message, with the GSS-API header values indicated.ScramSession.ServerFirstProcessorreceiveServerFirstMessage(String serverFirstMessage)Constructs a handler for the server-first-message, from its String representation.
-
-
-
Constructor Detail
-
ScramSession
public ScramSession(com.ongres.scram.common.ScramMechanism scramMechanism, com.ongres.scram.common.stringprep.StringPreparation stringPreparation, String user, String nonce)Constructs a SCRAM client, to perform an authentication for a given user. This class can be instantiated directly, but it is recommended that aScramClientis used instead.- Parameters:
scramMechanism- The SCRAM mechanism that will be using this clientstringPreparation-user-nonce-
-
-
Method Detail
-
clientFirstMessage
public String clientFirstMessage(com.ongres.scram.common.gssapi.Gs2CbindFlag gs2CbindFlag, String cbindName, String authzid)
Returns the text representation of a SCRAM client-first-message, with the GSS-API header values indicated.- Parameters:
gs2CbindFlag- The channel binding flagcbindName- The channel binding algorithm name, if channel binding is supported, or nullauthzid- The optional- Returns:
- The message
-
clientFirstMessage
public String clientFirstMessage()
Returns the text representation of a SCRAM client-first-message, with no channel binding nor authzid.- Returns:
- The message
-
receiveServerFirstMessage
public ScramSession.ServerFirstProcessor receiveServerFirstMessage(String serverFirstMessage) throws com.ongres.scram.common.exception.ScramParseException, IllegalArgumentException
Constructs a handler for the server-first-message, from its String representation.- Parameters:
serverFirstMessage- The message- Returns:
- The handler
- Throws:
com.ongres.scram.common.exception.ScramParseException- If the message is not a valid server-first-messageIllegalArgumentException- If the message is null or empty
-
-