@@ -0,0 +1,1592 @@
+package org.skyve.impl.security;%0A%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A%0Aimport org.apache.commons.codec.binary.Base64;%0Aimport org.skyve.util.Util;%0Aimport org.springframework.security.crypto.password.PasswordEncoder;%0A%0A/**%0A * Enable unsalted MD5 and SHA1 password encoding and matching for back compat.%0A * @author mike%0A */%0Apublic class SkyveLegacyPasswordEncoder implements PasswordEncoder %7B%0A%09@Override%0A%09public String encode(CharSequence rawPassword) %7B%0A%09%09return encode(rawPassword, Util.getPasswordHashingAlgorithm());%0A%09%7D%0A%09%0A%09@Override%0A%09public boolean matches(CharSequence rawPassword, String encodedPassword) %7B%0A%09%09int encodedPasswordLength = encodedPassword.length();%0A%09%09String passwordHashingAlgorithm = Util.getPasswordHashingAlgorithm();%0A%09%09if (encodedPasswordLength == 28) %7B%0A%09%09%09passwordHashingAlgorithm = %22SHA1%22;%0A%09%09%7D%0A%09%09else if (encodedPasswordLength == 24) %7B%0A%09%09%09passwordHashingAlgorithm = %22MD5%22;%0A%09%09%7D%0A%09%09return matches(rawPassword, encodedPassword, passwordHashingAlgorithm);%0A%09%7D%0A%09%0A%09public static String encode(CharSequence rawPassword, String passwordHashingAlgorithm) %7B%0A%09%09try %7B%0A%09%09%09MessageDigest md = MessageDigest.getInstance(passwordHashingAlgorithm);%0A%09%09%09Base64 base64Codec = new Base64();%0A%09%09%09return new String(base64Codec.encode(md.digest(rawPassword.toString().getBytes())));%0A%09%09%7D%0A%09%09catch (NoSuchAlgorithmException e) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static boolean matches(CharSequence rawPassword, String encodedPassword, String passwordHashingAlgorithm) %7B%0A%09%09return encodedPassword.equals(encode(rawPassword, passwordHashingAlgorithm));%0A%09%7D%0A%7D%0A

Add SkyveLegacyPasswordEncoder.