密码加密接口

在其他系统与DataViz产品集成时,存在不需要做单点登录(SSO)集成但是又要使用原有系统中的用户登录DataViz的情况,这就需要替换密码加密的实现方法。

1.1 前提条件

需要实现用户管理接口

1.2 接口说明

接口名称:org.springframework.security.crypto.password.PasswordEncoder

public interface PasswordEncoder {

    /**
     * 加密方法,对传入的字符串进行加密,返回加密后的字符串
     * @param 加密前的字符串
     */
    String encode(CharSequence rawPassword);

    /**
     * 密码验证方法,比较加密前和加密后的字符串是否匹配
     * 对rawPassword进行加密,在与encodedPassword比较
     * @param 加密前的字符串
     * @param 加密后的字符串
     * @return 
     */
    boolean matches(CharSequence rawPassword, String encodedPassword);

}

1.3 配置修改

修改applicationContext-security.xml配置文件,把其中的实现类改为实际的加密算法类。

  <beans:bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" />

results matching ""

    No results matching ""

    results matching ""

      No results matching ""