Search in sources :

Example 1 with SpringCacheBasedUserCache

use of org.springframework.security.core.userdetails.cache.SpringCacheBasedUserCache in project spring-security by spring-projects.

the class DaoAuthenticationProviderTests method testGettersSetters.

@Test
public void testGettersSetters() {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setPasswordEncoder(new BCryptPasswordEncoder());
    assertThat(provider.getPasswordEncoder().getClass()).isEqualTo(BCryptPasswordEncoder.class);
    provider.setUserCache(new SpringCacheBasedUserCache(mock(Cache.class)));
    assertThat(provider.getUserCache().getClass()).isEqualTo(SpringCacheBasedUserCache.class);
    assertThat(provider.isForcePrincipalAsString()).isFalse();
    provider.setForcePrincipalAsString(true);
    assertThat(provider.isForcePrincipalAsString()).isTrue();
}
Also used : BCryptPasswordEncoder(org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder) SpringCacheBasedUserCache(org.springframework.security.core.userdetails.cache.SpringCacheBasedUserCache) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 SpringCacheBasedUserCache (org.springframework.security.core.userdetails.cache.SpringCacheBasedUserCache)1 BCryptPasswordEncoder (org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder)1