Class ScramMechanism

java.lang.Object
org.wildfly.security.mechanism.scram.ScramMechanism

public final class ScramMechanism extends Object
Implementation of the SCRAM authentication mechanism.
Author:
David M. Lloyd
  • Field Details

  • Method Details

    • createClient

      public ScramClient createClient(String authorizationId, CallbackHandler callbackHandler, SecureRandom secureRandom, ChannelBindingCallback bindingCallback, int minimumIterationCount, int maximumIterationCount, Supplier<Provider[]> providers) throws AuthenticationMechanismException
      Create a SCRAM client for this mechanism.
      Parameters:
      authorizationId - the authorization ID (null if none is given)
      callbackHandler - the callback handler (may not be null)
      secureRandom - an optional secure random implementation to use (may be null)
      bindingCallback - the optional channel binding callback result (may be null)
      minimumIterationCount - the minimum iteration count to allow
      maximumIterationCount - the maximum iteration count to allow
      providers - the security providers.
      Returns:
      the SCRAM client, or null if the client cannot be created from this mechanism variant
      Throws:
      AuthenticationMechanismException - if the mechanism fails for some reason
      See Also:
    • createServer

      public ScramServer createServer(CallbackHandler callbackHandler, SecureRandom random, ChannelBindingCallback bindingCallback, int minimumIterationCount, int maximumIterationCount, Supplier<Provider[]> providers) throws AuthenticationMechanismException
      Create a SCRAM server for this mechanism.
      Parameters:
      callbackHandler - the callback handler (may not be null).
      random - an optional secure random implementation to use (may be null).
      bindingCallback - the optional channel binding callback result (may be null).
      minimumIterationCount - the minimum iteration count to allow.
      maximumIterationCount - the maximum iteration count to allow.
      providers - the security providers.
      Returns:
      the SCRAM server, or null if the server cannot be created from this mechanism variant.
      Throws:
      AuthenticationMechanismException - if the mechanism fails for some reason.
    • getHashSize

      public int getHashSize()
      Returns the size of the hash of the SCRAM mechanism.
      Returns:
      the size of the hash of the SCRAM mechanism.
    • getMessageDigestName

      public String getMessageDigestName()
      Returns the name of the message digest algorithm.
      Returns:
      the name of the message digest algorithm.
    • getHmacName

      public String getHmacName()
      Returns the name of the HMAC algorithm.
      Returns:
      the name of the HMAC algorithm.
    • isPlus

      public boolean isPlus()
      Returns whether the SCRAM mechanism uses the PLUS channel binding.
      Returns:
      true to use the PLUS channel binding, false otherwise.
    • getPasswordAlgorithm

      public String getPasswordAlgorithm()
      Returns the name of the password algorithm from ScramDigestPassword.
      Returns:
      the name of the password algorithm.
    • toString

      public String toString()
      Returns a String representation of the SCRAM mechanism. Contains the Digest name, PLUS channel binding and hash size.
      Overrides:
      toString in class Object
      Returns:
      a String representation of the SCRAM mechanism.