package ddth.dasp.servlet.runtime.us; /** * Provides APIs to encode (and decode if supported) user's password. Note: * password is case-sensitive. * * @author NBThanh <btnguyen2k@gmail.com> */ public interface IPasswordEncoder { /** * Decodes an encoded password. * * @param encodedPassword * String * @return String an array where the first element is the original password * and the second element is the salt, or null if the encoded * password can not be decoded */ public String[] decodePassword(String encodedPassword); /** * Encodes a raw password. * * @param rawPassword * String * @param salt * Object * @return String */ public String encodePassword(String rawPassword, Object salt); /** * Is decoding supported? * * @return boolean */ public boolean isDecodingSupported(); /** * Validates a raw password against an encoded one. The encoded password * should have previously been generated by the * {@link #encodePassword(String, Object)}. * * @param encodedPassword * String * @param rawPassword * String * @param salt * Object * @return boolean */ public boolean isPasswordValid(String encodedPassword, String rawPassword, Object salt); }