java类org.springframework.security.core.userdetails.cache.NullUserCache的实例源码

VistaAuthenticationProviderTest.java 文件源码 项目:eHMP 阅读 27 收藏 0 点赞 0 评论 0
@Test
public void testStartupFailsIfNoUserCacheSet() throws Exception {
    VistaAuthenticationProvider provider = new VistaAuthenticationProvider();
    provider.setUserDetailsService(mockUserDetailService);
    assertEquals(NullUserCache.class, provider.getUserCache().getClass());
    provider.setUserCache(null);

    try {
        provider.afterPropertiesSet();
        fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
        assertTrue(true);
    }
}
UserServiceImpl.java 文件源码 项目:eMonocot 阅读 25 收藏 0 点赞 0 评论 0
public UserServiceImpl() {
    saltSource = new ReflectionSaltSource();
    ((ReflectionSaltSource) saltSource).setUserPropertyToUse("getUsername");
    passwordEncoder = new Md5PasswordEncoder();
    userCache = new NullUserCache();
}


问题


面经


文章

微信
公众号

扫码关注公众号