Package org.springframework.security.userdetails

Examples of org.springframework.security.userdetails.UserDetailsService.loadUserByUsername()


  public void testLoadUserByUsername() throws Exception {

    final UserDetailsService mock1 = mock( UserDetailsService.class );
    UserDetails joeDetails = mock( UserDetails.class );
    UserDetails adminDetails = mock( UserDetails.class );
    when( mock1.loadUserByUsername( "joe" ) ).thenReturn( joeDetails );
    final UserDetailsService mock2 = mock( UserDetailsService.class );
    when( mock1.loadUserByUsername( "admin" ) ).thenReturn( adminDetails );

    ChainedUserDetailsService userDetailsService = new ChainedUserDetailsService( Arrays.asList( mock1, mock2 )  );
    final UserDetails joe = userDetailsService.loadUserByUsername( "joe" );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.