Class AuthFileBCryptHash

java.lang.Object
edu.ucsb.nceas.metacat.authentication.AuthFileBCryptHash
All Implemented Interfaces:
AuthFileHashInterface

public class AuthFileBCryptHash extends 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 Details

    • AuthFileBCryptHash

      public AuthFileBCryptHash()
      Default Constructor
  • Method Details

    • match

      public boolean match(String plain, String hashed) throws 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:
      Exception
    • hash

      public String hash(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