Examples of loadUserByUsername()


Examples of org.springframework.security.provisioning.JdbcUserDetailsManager.loadUserByUsername()

                "users-by-username-query='"+ userQuery +"' " +
                "authorities-by-username-query='" + authoritiesQuery + "'/>" + DATA_SOURCE);
        JdbcUserDetailsManager mgr = (JdbcUserDetailsManager) appContext.getBean("myUserService");
        assertEquals(userQuery, FieldUtils.getFieldValue(mgr, "usersByUsernameQuery"));
        assertEquals(authoritiesQuery, FieldUtils.getFieldValue(mgr, "authoritiesByUsernameQuery"));
        assertTrue(mgr.loadUserByUsername("rod") != null);
    }

    @Test
    public void groupQueryIsParsedCorrectly() throws Exception {
        setContext("<jdbc-user-service id='myUserService' " +
View Full Code Here

Examples of org.springframework.security.provisioning.JdbcUserDetailsManager.loadUserByUsername()

    @Test
    public void rolePrefixIsUsedWhenSet() {
        setContext("<jdbc-user-service id='myUserService' role-prefix='PREFIX_' data-source-ref='dataSource'/>" + DATA_SOURCE);
        JdbcUserDetailsManager mgr = (JdbcUserDetailsManager) appContext.getBean("myUserService");
        UserDetails rod = mgr.loadUserByUsername("rod");
        assertTrue(AuthorityUtils.authorityListToSet(rod.getAuthorities()).contains("PREFIX_ROLE_SUPERVISOR"));
    }


    private void setContext(String context) {
View Full Code Here

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.