我使用spring、spring 4、SpringSecurity4和mysql作为我的新web应用程序的数据存储库,我有两个问题
发布于 2016-03-07 17:35:53
1)我不明白这个问题,因为如果你必须找到一个名为"Quentin“的用户的权限,你怎么知道"Quentin”的id?
请看一下我在登录时检索用户的查询。
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT username, password, CASE enabled WHEN 1 THEN 'true' ELSE 'false' END 'enabled' FROM users WHERE BINARY username=?"
authorities-by-username-query="SELECT username, authority FROM users WHERE BINARY username=?"
id="jdbcUserService" />
<password-encoder ref="passwordEncoder" hash="bcrypt" />
</authentication-provider>
</authentication-manager>
<beans:bean id="passwordEncoder"
class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" />2)盐与密码一起保存。关于这是如何做到的,here有一个很棒的解释
https://stackoverflow.com/questions/35837724
复制相似问题