Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
This commit is contained in:
Tran Ngoc Nhan 2025-05-22 10:55:51 +07:00 committed by Josh Cummings
parent c9bbf3787b
commit 88369cd252
2 changed files with 6 additions and 5 deletions

View File

@ -605,6 +605,7 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl
* set this to {@code true} to enable password updates.
* @param enableUpdatePassword {@code true} to enable password updates, {@code false}
* otherwise.
* @since 7.0
*/
public void setEnableUpdatePassword(boolean enableUpdatePassword) {
this.enableUpdatePassword = enableUpdatePassword;
@ -626,6 +627,7 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl
/**
* Conditionally updates password based on the setting from
* {@link #setEnableUpdatePassword(boolean)}. {@inheritDoc}
* @since 7.0
*/
@Override
public UserDetails updatePassword(UserDetails user, String newPassword) {

View File

@ -285,10 +285,9 @@ public class JdbcUserDetailsManagerTests {
}
@Test
@SuppressWarnings("unchecked")
public void createGroupInsertsCorrectData() {
this.manager.createGroup("TEST_GROUP", AuthorityUtils.createAuthorityList("ROLE_X", "ROLE_Y"));
List roles = this.template.queryForList("select ga.authority from groups g, group_authorities ga "
List<?> roles = this.template.queryForList("select ga.authority from groups g, group_authorities ga "
+ "where ga.group_id = g.id " + "and g.group_name = 'TEST_GROUP'");
assertThat(roles).hasSize(2);
}
@ -367,7 +366,7 @@ public class JdbcUserDetailsManagerTests {
// SEC-2166
@Test
public void createNewAuthenticationUsesNullPasswordToKeepPassordsSave() {
public void createNewAuthenticationUsesNullPasswordToKeepPasswordSave() {
insertJoe();
UsernamePasswordAuthenticationToken currentAuth = UsernamePasswordAuthenticationToken.authenticated("joe", null,
AuthorityUtils.createAuthorityList("ROLE_USER"));
@ -443,9 +442,9 @@ public class JdbcUserDetailsManagerTests {
this.cache.putUserInCache(joe);
}
private class MockUserCache implements UserCache {
private static class MockUserCache implements UserCache {
private Map<String, UserDetails> cache = new HashMap<>();
private final Map<String, UserDetails> cache = new HashMap<>();
@Override
public UserDetails getUserFromCache(String username) {