Class ManagedUser


public class ManagedUser extends User
A User that can be used for Logging in. Managed by the UserService.
  • Field Details

  • Constructor Details

  • Method Details

    • validatePassword

      public boolean validatePassword(String password)
      Validates a given password against the Users password+salt.
      Parameters:
      password - the given password
      Returns:
      true if passwords match
    • validatePassword

      public static boolean validatePassword(String passwordAsBase64, String saltAsBase64, String password)
      Validates if password+salt match the given password.
      Parameters:
      passwordAsBase64 - the hashed password
      saltAsBase64 - the salt
      password - the given password
      Returns:
      true if they match.
    • validatePassword

      public static boolean validatePassword(byte[] password1, byte[] salt, String password2)
      Validates if password+salt match the given password.
      Parameters:
      password1 - the hashed password
      salt - the salt
      password2 - the given password
      Returns:
      true if they match.
    • hashPassword

      public static byte[] hashPassword(String password, byte[] salt, int iterations, int keyLength)
      Hashes a password. Source: https://www.owasp.org/index.php/Hashing_Java.
      Parameters:
      password - the password
      salt - the salt
      iterations - the number of iterations
      keyLength - the length of the key
      Returns:
      the hashed password
    • hashPassword

      public static byte[] hashPassword(char[] password, byte[] salt, int iterations, int keyLength)
      Hashes a password. Source: https://www.owasp.org/index.php/Hashing_Java.
      Parameters:
      password - the password
      salt - the salt
      iterations - the number of iterations
      keyLength - the length of the key
      Returns:
      the hashed password