Package org.springframework.security.provisioning

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


    @Test
    public void validUsernameIsFound() {
        setContext("<jdbc-user-service data-source-ref='dataSource'/>" + DATA_SOURCE);
        JdbcUserDetailsManager mgr = (JdbcUserDetailsManager) appContext.getBean(BeanIds.USER_DETAILS_SERVICE);
        assertNotNull(mgr.loadUserByUsername("rod"));
    }

    @Test
    public void beanIdIsParsedCorrectly() {
        setContext("<jdbc-user-service id='myUserService' data-source-ref='dataSource'/>" + DATA_SOURCE);
View Full Code Here


                "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

    @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

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.