将SSM架构中原来关于springSecurity3.x版本的写法配迁移到SpringBoot2.0框架中出现的问题解决记

迁移过程中关于这个安全框架的问题很麻烦,springBoot自带的stater中的版本是5.0,原来系统有通过实现“org.springframework.security.authentication.dao.SaltSource”接口给密码提供Salt,但是出现了以下问题:
迁移过程中关于这个安全框架的问题很麻烦,springBoot自带的stater中的版本是5.0,原来系统有通过实现“org.springframework.security.authentication.dao.SaltSource”接口给密码提供Salt,但是出现了以下问题:
(1)5中没有了这个接口找了很久也找不可替代接口或者类,后来想着降低版本,降低到了跟原来系统相同的3.X版本
(2)原来的加密类“org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder;”和“org.springframework.security.authentication.encoding.Md5PasswordEncoder;”而是推荐使用“BCryptPasswordEncoder”来进行动态加密,要实现自定义的加密的话需要实现“import org.springframework.security.crypto.password.PasswordEncoder”接口,并且没有没找到MD5算法,跟现有系统有冲突
(3)降低到了3.X版本发现不支持SpringBoot配置中的“org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter”,后来又找了4.X版本发现该版本中上面用到的类或者接口虽然已经声明为“Deprecated”但是依旧没有删除,因此暂时就用这个版本了“4.2.6.RELEASE”这样就最小化的解决了。
小结:
(1)SpringBoot中配置jar包有两种形式:一种是XXX-starter形式;另外一种是自己单独在maven的pom文件中利用“dependence”标签引用。

原文地址:https://www.cnblogs.com/jpfss/p/9050491.html