edu.ucsb.nceas.metacat.authentication

## Class AuthFileBCryptHash

- java.lang.Object
- - edu.ucsb.nceas.metacat.authentication.AuthFileBCryptHash

- All Implemented Interfaces:
    AuthFileHashInterface

      public class AuthFileBCryptHash
      extends java.lang.Object
      implements AuthFileHashInterface

  A class to use the BCryptHash algorithm to generate the hash. This is a recommended way to protect password.
  Author:
    tao

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthFileBCryptHash()` Default Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `hash(java.lang.String plain)` Generate the hash value for a specified plaint password
    `boolean` | `match(java.lang.String plain, java.lang.String hashed)` Check if the plain password matches the hashed password.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AuthFileBCryptHash

          public AuthFileBCryptHash()

      Default Constructor

  - ### Method Detail

    - #### match

          public boolean match(java.lang.String plain,
                               java.lang.String hashed)
                        throws java.lang.Exception

      Description copied from interface: `AuthFileHashInterface`
      Check if the plain password matches the hashed password. Return true if they match; false otherwise.
      Specified by:
        `match` in interface `AuthFileHashInterface`
      Parameters:
        `plain` - the plain password
        `hashed` - the hashed password
      Returns:
        true if they match
      Throws:
        `java.lang.Exception`

    - #### hash

          public java.lang.String hash(java.lang.String plain)

      Description copied from interface: `AuthFileHashInterface`
      Generate the hash value for a specified plaint password
      Specified by:
        `hash` in interface `AuthFileHashInterface`
      Parameters:
        `plain` - the plain password
      Returns:
        the hash value of the password

Copyright © 2020 Regents of the University of California. All Rights Reserved.