io.vertx.reactivex.ext.auth.jdbc

## Class JDBCHashStrategy

- java.lang.Object
- - io.vertx.reactivex.ext.auth.jdbc.JDBCHashStrategy

-     public class JDBCHashStrategy
      extends Object

  Determines how the hashing is computed in the implementation You can implement this to provide a different hashing strategy to the default.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<JDBCHashStrategy>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JDBCHashStrategy(JDBCHashStrategy delegate)`
    `JDBCHashStrategy(Object delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `computeHash(String password, String salt, int version)` Compute the hashed password given the unhashed password and the salt
    `static JDBCHashStrategy` | `createPBKDF2(Vertx vertx)` Implements a Hashing Strategy as per https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet (2018-01-17).
    `static JDBCHashStrategy` | `createSHA512(Vertx vertx)` This is the current backwards compatible hashing implementation, new applications should prefer the PBKDF2 implementation, unless the tradeoff between security and CPU usage is an option.
    `boolean` | `equals(Object o)`
    `String` | `generateSalt()` Compute a random salt.
    `JDBCHashStrategy` | `getDelegate()`
    `String` | `getHashedStoredPwd(JsonArray row)` Retrieve the hashed password from the result of the authentication query
    `String` | `getSalt(JsonArray row)` Retrieve the salt from the result of the authentication query
    `int` | `hashCode()`
    `static boolean` | `isEqual(String hasha, String hashb)` Time constant string comparision to avoid timming attacks.
    `static JDBCHashStrategy` | `newInstance(JDBCHashStrategy arg)`
    `void` | `setNonces(JsonArray nonces)` Sets a ordered list of nonces where each position corresponds to a version.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<JDBCHashStrategy> __TYPE_ARG

  - ### Constructor Detail

    - #### JDBCHashStrategy

          public JDBCHashStrategy(JDBCHashStrategy delegate)

    - #### JDBCHashStrategy

          public JDBCHashStrategy(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public JDBCHashStrategy getDelegate()

    - #### createSHA512

          public static JDBCHashStrategy createSHA512(Vertx vertx)

      This is the current backwards compatible hashing implementation, new applications should prefer the PBKDF2 implementation, unless the tradeoff between security and CPU usage is an option.
      Parameters:
        `vertx` - the vert.x instance
      Returns:
        the implementation.

    - #### createPBKDF2

          public static JDBCHashStrategy createPBKDF2(Vertx vertx)

      Implements a Hashing Strategy as per https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet (2018-01-17). New deployments should use this strategy instead of the default one (which was the previous OWASP recommendation). The work factor can be updated by using the nonces json array.
      Parameters:
        `vertx` - the vert.x instance
      Returns:
        the implementation.

    - #### generateSalt

          public String generateSalt()

      Compute a random salt.
      Returns:
        a non null salt value

    - #### computeHash

          public String computeHash(String password,
                                    String salt,
                                    int version)

      Compute the hashed password given the unhashed password and the salt
      Parameters:
        `password` - the unhashed password
        `salt` - the salt
        `version` - the nonce version to use
      Returns:
        the hashed password

    - #### getHashedStoredPwd

          public String getHashedStoredPwd(JsonArray row)

      Retrieve the hashed password from the result of the authentication query
      Parameters:
        `row` - the row
      Returns:
        the hashed password

    - #### getSalt

          public String getSalt(JsonArray row)

      Retrieve the salt from the result of the authentication query
      Parameters:
        `row` - the row
      Returns:
        the salt

    - #### setNonces

          public void setNonces(JsonArray nonces)

      Sets a ordered list of nonces where each position corresponds to a version. The nonces are supposed not to be stored in the underlying jdbc storage but to be provided as a application configuration. The idea is to add one extra variable to the hash function in order to make breaking the passwords using rainbow tables or precomputed hashes harder. Leaving the attacker only with the brute force approach. Nonces are dependent on the implementation. E.g.: for the SHA512 they are extra salt used during the hashing, for the PBKDF2 they map the number of iterations the algorithm should take
      Parameters:
        `nonces` - a json array.

    - #### isEqual

          public static boolean isEqual(String hasha,
                                        String hashb)

      Time constant string comparision to avoid timming attacks.
      Parameters:
        `hasha` - hash a to compare
        `hashb` - hash b to compare
      Returns:
        true if equal

    - #### newInstance

          public static JDBCHashStrategy newInstance(JDBCHashStrategy arg)

Copyright © 2020 Eclipse. All rights reserved.