Class PasswordHashPipe

All Implemented Interfaces:
HasTransactionAttribute, IConfigurable, IConfigurationAware, IForwardTarget, INamedObject, IPipe, IScopeProvider, IWithParameters, EventThrowing, HasStatistics, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Forward(name="failure", description="when hashSessionKey is used and password doesn\'t validate against the hash") @ElementType(TRANSLATOR) public class PasswordHashPipe extends FixedForwardPipe
Hash a password or validate a password against a hash using PasswordHash.java from https://crackstation.net/hashing-security.htm. Input of the pipe is expected to be the password. In case hashSessionKey isn't used a hash of the password is returned. In case hashSessionKey is used it is validated against the hash in the session key which will determine the forward to be used (success or failure).
Author:
Jaco de Groot
  • Constructor Details

    • PasswordHashPipe

      public PasswordHashPipe()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from class: FixedForwardPipe
      checks for correct configuration of forward
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IPipe
      Overrides:
      configure in class FixedForwardPipe
      Throws:
      ConfigurationException
    • doPipe

      public PipeRunResult doPipe(Message message, PipeLineSession session) throws PipeRunException
      Description copied from interface: IPipe
      This is where the action takes place. Pipes may only throw a PipeRunException, to be handled by the caller of this object. Implementations must either consume the message, or pass it on to the next Pipe in the PipeRunResult. If the result of the Pipe does not depend on the input, like for the FixedResultPipe, the Pipe can schedule the input to be closed at session exit, by calling Message.closeOnCloseOf(PipeLineSession, String) This allows the previous Pipe to release any resources (e.g. connections) that it might have kept open until the message was consumed. Doing so avoids connections leaking from pools, while it enables efficient streaming processing of data while it is being read from a stream.
      Throws:
      PipeRunException
    • getHashSessionKey

      public String getHashSessionKey()
    • setHashSessionKey

      public void setHashSessionKey(String hashSessionKey)
      name of sessionkey that holds the hash which will be used to validate the password (input of the pipe)
    • getRounds

      public int getRounds()
    • setRounds

      public void setRounds(int rounds)
    • getRoundsSessionKey

      public String getRoundsSessionKey()
    • setRoundsSessionKey

      public void setRoundsSessionKey(String roundsSessionKey)