Examples of loadUserByUsername()


Examples of org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService.loadUserByUsername()

    userRoleDao.setUserRoles( mainTenant_1, USER_2, new String[] { ROLE_1, ROLE_2, ROLE_3 } );

    UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
    userDetailsService.setUserRoleDao( userRoleDao );
    userDetailsService.setDefaultRole( tenantAuthenticatedRoleName );
    UserDetails userFromService = userDetailsService.loadUserByUsername( USER_2 );

    assertTrue( userFromService.getUsername().equals( USER_2 ) );
    assertTrue( userFromService.getPassword() != null );
    assertTrue( userFromService.isEnabled() == true );
    assertTrue( userFromService.getAuthorities().length == 4 );
View Full Code Here

Examples of org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService.loadUserByUsername()

    IPentahoUser pentahoUser = userRoleDao.createUser( mainTenant_1, USER_2, PASSWORD_2, USER_DESCRIPTION_2, null );

    UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
    userDetailsService.setUserRoleDao( userRoleDao );
    try {
      userDetailsService.loadUserByUsername( USER_2 );
    } catch ( UsernameNotFoundException unnf ) {
      assertNotNull( unnf );
    }

    cleanupUserAndRoles( mainTenant_1 );
View Full Code Here

Examples of org.springframework.security.config.authentication.CachingUserDetailsService.loadUserByUsername()

        setContext("<jdbc-user-service id='myUserService' cache-ref='userCache' data-source-ref='dataSource'/>"
                + DATA_SOURCE +USER_CACHE_XML);
        CachingUserDetailsService cachingUserService =
            (CachingUserDetailsService) appContext.getBean("myUserService" + AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX);
        assertSame(cachingUserService.getUserCache(), appContext.getBean("userCache"));
        assertNotNull(cachingUserService.loadUserByUsername("rod"));
        assertNotNull(cachingUserService.loadUserByUsername("rod"));
    }

    @Test
    public void isSupportedByAuthenticationProviderElement() {
View Full Code Here

Examples of org.springframework.security.config.authentication.CachingUserDetailsService.loadUserByUsername()

                + DATA_SOURCE +USER_CACHE_XML);
        CachingUserDetailsService cachingUserService =
            (CachingUserDetailsService) appContext.getBean("myUserService" + AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX);
        assertSame(cachingUserService.getUserCache(), appContext.getBean("userCache"));
        assertNotNull(cachingUserService.loadUserByUsername("rod"));
        assertNotNull(cachingUserService.loadUserByUsername("rod"));
    }

    @Test
    public void isSupportedByAuthenticationProviderElement() {
        setContext(
View Full Code Here

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

        }

        private UsernamePasswordAuthenticationToken authentication(ServletContext servletContext) {
            ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
            UserDetailsService userDetailsService = userDetailsService(context);
            UserDetails userDetails = userDetailsService.loadUserByUsername(this.username);
            return new UsernamePasswordAuthenticationToken(
                    userDetails, userDetails.getPassword(), userDetails.getAuthorities());
        }

        private UserDetailsService userDetailsService(ApplicationContext context) {
View Full Code Here

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

        }

        private UsernamePasswordAuthenticationToken authentication(ServletContext servletContext) {
            ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
            UserDetailsService userDetailsService = userDetailsService(context);
            UserDetails userDetails = userDetailsService.loadUserByUsername(this.username);
            return new UsernamePasswordAuthenticationToken(
                    userDetails, userDetails.getPassword(), userDetails.getAuthorities());
        }

        private UserDetailsService userDetailsService(ApplicationContext context) {
View Full Code Here

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

    public void userServiceWithValidPropertiesFileWorksSuccessfully() {
        setContext(
                "<user-service id='service' " +
                        "properties='classpath:org/springframework/security/config/users.properties'/>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        userService.loadUserByUsername("bob");
        userService.loadUserByUsername("joe");
    }

    @Test
    public void userServiceWithEmbeddedUsersWorksSuccessfully() {
View Full Code Here

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

        setContext(
                "<user-service id='service' " +
                        "properties='classpath:org/springframework/security/config/users.properties'/>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        userService.loadUserByUsername("bob");
        userService.loadUserByUsername("joe");
    }

    @Test
    public void userServiceWithEmbeddedUsersWorksSuccessfully() {
        setContext(
View Full Code Here

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

        setContext(
                "<user-service id='service'>" +
                "    <user name='joe' password='joespassword' authorities='ROLE_A'/>" +
                "</user-service>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        userService.loadUserByUsername("joe");
    }

    @Test
    public void namePasswordAndAuthoritiesSupportPlaceholders() {
        System.setProperty("principal.name", "joe");
View Full Code Here

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

                "<b:bean class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/>" +
                "<user-service id='service'>" +
                "    <user name='${principal.name}' password='${principal.pass}' authorities='${principal.authorities}'/>" +
                "</user-service>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        UserDetails joe = userService.loadUserByUsername("joe");
        assertEquals("joespassword", joe.getPassword());
        assertEquals(2, joe.getAuthorities().size());
    }

    @Test
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.