Class ScramSessionFactory
- java.lang.Object
-
- com.impossibl.postgres.protocol.sasl.scram.client.ScramSessionFactory
-
public class ScramSessionFactory extends Object
A factory to generate properly configuredScramSessioninstances. TheScramSessionFactoryitself must be instantiated usingScramSessionFactory.Builderto ensure a properly configured session factory.ScramSessionFactory.Builderis a declarative builder that allows consumers to provide only the required information (e.g. server advertised mechanisms, channel-binding method, etc.) and ensures they receive a properly configured factory with the strongest available authentication flow selected. Available builder methods for controlling authentication mechanism selection:-
ScramSessionFactory.Builder.serverAdvertisedMechanisms- The list of supported mechanisms advertised by the server. -
ScramSessionFactory.Builder.channelBindMethod- The selected/supported channel-bind method the client plans to use. -
ScramSessionFactory.Builder.preferChannelBindingMechanism(boolean)- Whether the selection process should favor selecting a mechanism that requires channel binding over a method that has a stronger algorithm. For example, if 'SCRAM-SHA1-PLUS' and 'SCRAM-SHA256' are the available methods should it favor the `SCRAM-SHA1-PLUS` because it requires channel binding.
-
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScramSessionFactory.Builder
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_NONCE_LENGTHDefault nonce byte length
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ScramSessionFactory.Builderbuilder()ScramSessionstart(String user)Instantiates aScramSessionfor the specified user with this factory's selected mechanism and algorithmic features.
-
-
-
Field Detail
-
DEFAULT_NONCE_LENGTH
public static final int DEFAULT_NONCE_LENGTH
Default nonce byte length- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public ScramSession start(String user)
Instantiates aScramSessionfor the specified user with this factory's selected mechanism and algorithmic features.- Parameters:
user- The username of the authentication exchange- Returns:
- The ScramSession instance
-
builder
public static ScramSessionFactory.Builder builder()
-
-