Class CryptoServiceImpl

java.lang.Object
dk.acto.fafnir.api.service.hazelcast.CryptoServiceImpl
All Implemented Interfaces:
CryptoService

@Service public class CryptoServiceImpl extends Object implements CryptoService
  • Field Details

    • passwordEncoder

      public final org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
  • Constructor Details

    • CryptoServiceImpl

      public CryptoServiceImpl()
  • Method Details

    • encodePassword

      public String encodePassword(String password, PublicKey publicKey)
      Description copied from interface: CryptoService
      Encodes the password. Will also encrypt it if publicKey is present.
      Specified by:
      encodePassword in interface CryptoService
      Parameters:
      password - the password to be encoded.
      publicKey - the publicKey to be used for encrypting. It can be null.
      Returns:
      the encoded password.
    • matches

      public Boolean matches(String password, String encoded, PrivateKey privateKey)
      Description copied from interface: CryptoService
      Checks if the plaintext password matches the encoded one. If privateKey is present it assumes the encoded to be encrypted also.
      Specified by:
      matches in interface CryptoService
      Parameters:
      password - the plaintext password.
      encoded - the encoded password.
      privateKey - the privateKey to be used for decrypting. It can be null.
      Returns:
      whether the password matches.