Class AtlassianSecurityPasswordEncoder

java.lang.Object
com.atlassian.crowd.password.encoder.AtlassianSecurityPasswordEncoder
All Implemented Interfaces:
InternalPasswordEncoder, PasswordEncoder, UpgradeablePasswordEncoder

public class AtlassianSecurityPasswordEncoder extends Object implements InternalPasswordEncoder, UpgradeablePasswordEncoder
This class is responsible for encoding and validating passwords using Atlassian Password Encoder from Atlassian Security project, while also validating passwords encoded in Atlassian SHA1 format in order to be backwards compatible.
  • Constructor Details

    • AtlassianSecurityPasswordEncoder

      public AtlassianSecurityPasswordEncoder()
  • Method Details

    • encodePassword

      public String encodePassword(String rawPass, Object salt) throws PasswordEncoderException
      Encodes the provided rawPass using an Atlassian Password Encoder from Atlassian Security project.
      Specified by:
      encodePassword in interface PasswordEncoder
      Parameters:
      rawPass - the password to encode
      salt - not used. A null value is legal.
      Returns:
      encoded password
      Throws:
      PasswordEncoderException - if there were any issues trying to encode a password
      See Also:
      • DefaultPasswordEncoder
    • isPasswordValid

      public boolean isPasswordValid(String encPass, String rawPass, Object salt)
      Returns true if the rawPass is the same password that was used to create encPass.
      Specified by:
      isPasswordValid in interface PasswordEncoder
      Parameters:
      encPass - a pre-encoded password in either Atlassian SHA1 form or the form provided by DefaultPasswordEncoder.getDefaultInstance() from atlassian-password-encoder.
      rawPass - a raw password to encode and compare against the pre-encoded password
      salt - not used. A null value is legal.
      Returns:
      true if the rawPass is the same password that was used to create encPass
    • isUpgradeRequired

      public boolean isUpgradeRequired(String encPass)
      Returns true if the password is encoded using an older scheme, and if it should be re-encoded and updated.
      Specified by:
      isUpgradeRequired in interface UpgradeablePasswordEncoder
      Parameters:
      encPass - a pre-encoded password
      Returns:
      true if the password is encoded using an older scheme, and if it should be re-encoded and updated.
    • getKey

      public String getKey()
      Description copied from interface: PasswordEncoder
      The key to define this password encoder
      Specified by:
      getKey in interface PasswordEncoder