Comments (2)
加密方式这里是否考虑通过SPI机制去实现是否会更好,内置默认加密方式,用户也可使用自己的加密方式
from ballcat.
加密方式这里是否考虑通过SPI机制去实现是否会更好,内置默认加密方式,用户也可使用自己的加密方式
设计之初就提供了这样的机制,用户可以通过自定义 PasswordEncoder 实现密码加解密方式替换,目前主要是修改密码这里写死了,需要修改。
当前实现
目前登录时,会利用注册在 spring 容器中的密码编码器 PasswordEncoder 实例,进行密码的加密以及匹配:
ballcat 默认的 PasswordEncoder 使用的是 DelegatingPasswordEncoder(用户可以自己注册 PasswordEncoder 进行替换这一行为),使用该密码编码器加密时获得的密文格式为:{bcrypt}算法密文
,进行密码匹配测试时使用的数据格式为:{加密算法}算法密文
。
目前支持以下加密算法,当加密算法部分为空时,默认使用 bcrypt 算法。
- bcrypt
- ldap
- MD4
- MD5
- noop
- pbkdf2
- scrypt
- SHA-1
- SHA-256
- sha256
- sha256
示例
如明文密码:a123456
使用 MD5 加密后的的密文为 dc483e80a7a0bd9ef71d8cf973673924
使用 bcrypt 加密后的密文为 $2a$10$iBJZLHRVrjpJCKVNUZw6B.wbdClhvVdT91KbN25sTjbn1MJT4wqmm
那么,当使用 DelegatingPasswordEncoder 进行匹配时,以下几种数据都将返回 true:
$2a$10$iBJZLHRVrjpJCKVNUZw6B.wbdClhvVdT91KbN25sTjbn1MJT4wqmm
{bcrypt}$2a$10$iBJZLHRVrjpJCKVNUZw6B.wbdClhvVdT91KbN25sTjbn1MJT4wqmm
{MD5}dc483e80a7a0bd9ef71d8cf973673924
{noop}a123456
也就是说在 sys_user 表中的 password 字段,支持同时存在多种加密方式,方便密码加密算法的迁移
from ballcat.
Related Issues (20)
- 菜单配置 HOT 3
- 是否有增加租户的计划 HOT 7
- 数据权限 HOT 1
- 1.0.0 内置的 LogConfiguration 由于 conditional 优先级问题导致相关 bean 没有成功注册
- LambdaAliasWrapper 嵌套条件构建时,生成的 SQL 条件对应值为 null HOT 1
- 日志模块记录访问日志,能否考虑接口自定义是否记录访问日志的请求头或返回体 HOT 3
- 访问日志功能优化
- 国际化 中 I18nField注解的 code也是支持Spel的吗,但是不生效 HOT 6
- Dependency org.yaml:snakeyaml, leading to CVE problem HOT 1
- 国际化反射翻译设置值出现性能问题,这个有思路吗 HOT 5
- 有一些mapper的xml为什么找不到呀 HOT 3
- 教程:使数据范围权限DataScope支持Bean Searcher HOT 2
- 数据权限扩展以便支持其他 ORM 框架
- 页面缓存失败,切换tabs标签页时,页面接口重复请求2次 HOT 3
- 官网域名需要备案 HOT 2
- 数据库脚本在mysql 5.7.30 执行错误 HOT 1
- 建议重构或修复关于天一弘短信服务 HOT 1
- SAS模式下未配置resourceserver属性导致初始化失败 HOT 2
- 无法正确本地化security错误信息
- excel导入校验字段时未采用框架i18n正确输出最终的文案 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ballcat.