Class Md5PasswordEncoder

java.lang.Object
com.gigaspaces.security.encoding.md5.Md5PasswordEncoder
All Implemented Interfaces:
PasswordEncoder

public class Md5PasswordEncoder extends Object implements PasswordEncoder
Encodes passwords using the MD5 algorithm. The encoded password is returned as Hex (32 char) version of the hash bytes.
Since:
7.0.1
Author:
Moran Avigdor
  • Constructor Details

    • Md5PasswordEncoder

      public Md5PasswordEncoder()
  • Method Details

    • encodePassword

      public String encodePassword(String rawPass) throws EncodingException
      Description copied from interface: PasswordEncoder
      Encodes the specified raw password with an implementation specific algorithm.

      This will generally be a one-way message digest such as MD5 or SHA, but may also be a plaintext variant which does no encoding at all, but rather returns the same password it was fed. The latter is useful to plug in when the original password must be stored as-is.

      Specified by:
      encodePassword in interface PasswordEncoder
      Parameters:
      rawPass - the password to encode
      Returns:
      encoded password
      Throws:
      EncodingException - if couldn't encode the raw password
    • isPasswordValid

      public boolean isPasswordValid(String encPass, String rawPass) throws EncodingException
      Description copied from interface: PasswordEncoder
      Validates a specified "raw" password against an encoded password.

      The encoded password should have previously been generated by PasswordEncoder.encodePassword(String) . This method will encode the rawPass, and then compare it with the presented encPass.

      Specified by:
      isPasswordValid in interface PasswordEncoder
      Parameters:
      encPass - a pre-encoded password
      rawPass - a raw password to encode and compare against the pre-encoded password
      Returns:
      true if the password is valid, false otherwise
      Throws:
      EncodingException - if couldn't encode the raw password (see PasswordEncoder.encodePassword(String))