自定义PasswordEncoder

时间:2011-05-24 09:43:35

标签: spring-security

我需要创建一个自定义密码编码器。我已完成以下任务:

的applicationContext-security.xml文件

<authentication-manager alias="authenticationManager">
    <authentication-provider>
        <password-encoder ref="AppPasswordEncoder" /> 
        <jdbc-user-service data-source-ref="dataSource" authorities-by-username-query="select username,password from username where username=?"/>
    </authentication-provider>
    <beans:bean class="com.app.security.MyPasswordEncoder" id="AppPasswordEncoder"/>
</authentication-manager>

public class SnatiPasswordEncoder implements PasswordEncoder {

    @Override
    public String encodePassword(String arg0, Object arg1)
            throws DataAccessException {
        return null;
    }

    @Override
    public boolean isPasswordValid(String arg0, String arg1, Object arg2)
            throws DataAccessException {
        return false;
    }
}

对密码进行编码的几个步骤:

ISO-8859-1
md5
base64

下一步应该是什么?

0 个答案:

没有答案