@Test public void testExternalUserShouldBeReplacedWhenExpired() { UserDto user = new UserDto(); user.setUsername(TEST_DUPLICATE_USER); user.setPassword("foobarpasswrod"); user.setSourceId("someExternalUserSourceId"); user.setLastUpdate(new Date()); strongboxUserManager.cacheExternalUserDetails("someExternalUserSourceId", new StrongboxUserDetails(user)); UserDetails userDetails = userDetailsService.loadUserByUsername(TEST_DUPLICATE_USER); assertThat(userDetails).isNotNull(); assertThat(userDetails).isInstanceOf(SpringSecurityUser.class); assertThat(((SpringSecurityUser)userDetails).getSourceId()).isEqualTo("someExternalUserSourceId"); expireUser(TEST_DUPLICATE_USER); userDetails = userDetailsService.loadUserByUsername(TEST_DUPLICATE_USER); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(TEST_DUPLICATE_USER); assertThat(userDetails).isInstanceOf(SpringSecurityUser.class); assertThat(((SpringSecurityUser)userDetails).getSourceId()).isEqualTo("yamlUserDetailService"); }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return loadUserDetails(username).map(userDetailsMapper) .orElseThrow(() -> new UsernameNotFoundException(username)); }
ConfigurableProviderManager extends ProviderManager implements UserDetailsService, AuthenticationItemConfigurationManager { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return loadUserDetails(username).map(userDetailsMapper) .orElseThrow(() -> new UsernameNotFoundException(username)); } }
ConfigurableProviderManager extends ProviderManager implements UserDetailsService, AuthenticationItemConfigurationManager { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return loadUserDetails(username).map(userDetailsMapper) .orElseThrow(() -> new UsernameNotFoundException(username)); } ConfigurableProviderManager(); }
ConfigurableProviderManager extends ProviderManager implements UserDetailsService, AuthenticationItemConfigurationManager { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return loadUserDetails(username).map(userDetailsMapper) .orElseThrow(() -> new UsernameNotFoundException(username)); } ConfigurableProviderManager(); void reload(); @Override List<AuthenticationProvider> getProviders(); @Override UserDetails loadUserByUsername(String username); @Override Authentication authenticate(Authentication authentication); void reorder(String first,
                        String second); @Override void updateAuthenticationItems(AuthenticationItems items); @Override AuthenticationItems getAuthenticationItems(); @Override T getCustomAuthenticationItem(CustomAuthenticationItemMapper<T> mapper); @Override void putCustomAuthenticationItem(T customAuthenticationItem,
                                                CustomAuthenticationItemMapper<T> mapper); @Override void testCustomAuthenticationItem(T customAuthenticationItem,
                                                 CustomAuthenticationItemMapper<T> mapper,
                                                 Predicate<ApplicationContext> p); @EventListener({ ContextRefreshedEvent.class }) void contextRefreshedEvent(ContextRefreshedEvent e); }
ConfigurableProviderManager extends ProviderManager implements UserDetailsService, AuthenticationItemConfigurationManager { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return loadUserDetails(username).map(userDetailsMapper) .orElseThrow(() -> new UsernameNotFoundException(username)); } ConfigurableProviderManager(); void reload(); @Override List<AuthenticationProvider> getProviders(); @Override UserDetails loadUserByUsername(String username); @Override Authentication authenticate(Authentication authentication); void reorder(String first,
                        String second); @Override void updateAuthenticationItems(AuthenticationItems items); @Override AuthenticationItems getAuthenticationItems(); @Override T getCustomAuthenticationItem(CustomAuthenticationItemMapper<T> mapper); @Override void putCustomAuthenticationItem(T customAuthenticationItem,
                                                CustomAuthenticationItemMapper<T> mapper); @Override void testCustomAuthenticationItem(T customAuthenticationItem,
                                                 CustomAuthenticationItemMapper<T> mapper,
                                                 Predicate<ApplicationContext> p); @EventListener({ ContextRefreshedEvent.class }) void contextRefreshedEvent(ContextRefreshedEvent e);  }