Examples of UserDetailsService


Examples of com.evasion.plugin.security.UserDetailsService

    public StaticPage createPage(StaticPage page, String userName) throws PersistenceViolationException {
        if (page.getId() != null) {
            throw new PersistenceViolationException("Cette méthode ne peut être utilisé pour une page déja existente");
        }
        User user = new UserDetailsService(em).findUserByUserName(userName);
        page.setUser(user);
        return savePage(page);
    }
View Full Code Here

Examples of org.acegisecurity.userdetails.UserDetailsService

*/
public class UserDetailsServiceProxy implements UserDetailsService {
    private volatile UserDetailsService delegate;

    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        UserDetailsService uds = delegate;  // fix the reference for concurrency support

        if(uds ==null)
            throw new UserMayOrMayNotExistException(Messages.UserDetailsServiceProxy_UnableToQuery(username));
        return uds.loadUserByUsername(username);
    }
View Full Code Here

Examples of org.acegisecurity.userdetails.UserDetailsService

        public SecurityComponents createSecurityComponents() {
            return new SecurityComponents(new AuthenticationManager() {
                public Authentication authenticate(Authentication authentication) {
                    return authentication;
                }
            }, new UserDetailsService() {
                public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
                    throw new UsernameNotFoundException(username);
                }
            });
        }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

            return request;
        }

        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());
        }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

            return request;
        }

        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());
        }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

    @Test
    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");
    }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

    public void userServiceWithEmbeddedUsersWorksSuccessfully() {
        setContext(
                "<user-service id='service'>" +
                "    <user name='joe' password='joespassword' authorities='ROLE_A'/>" +
                "</user-service>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        userService.loadUserByUsername("joe");
    }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

        setContext(
                "<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());
    }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

    public void embeddedUsersWithNoPasswordIsGivenGeneratedValue() {
        setContext(
                "<user-service id='service'>" +
                "    <user name='joe' authorities='ROLE_A'/>" +
                "</user-service>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        UserDetails joe = userService.loadUserByUsername("joe");
        assertTrue(joe.getPassword().length() > 0);
        Long.parseLong(joe.getPassword());
    }
View Full Code Here

Examples of org.springframework.security.core.userdetails.UserDetailsService

        setContext(
                "<user-service id='service'>" +
                "    <user name='http://joe.myopenid.com/' authorities='ROLE_A'/>" +
                "    <user name='https://www.google.com/accounts/o8/id?id=MPtOaenBIk5yzW9n7n9' authorities='ROLE_A'/>" +
                "</user-service>");
        UserDetailsService userService = (UserDetailsService) appContext.getBean("service");
        assertEquals("http://joe.myopenid.com/", userService.loadUserByUsername("http://joe.myopenid.com/").getUsername());
        assertEquals("https://www.google.com/accounts/o8/id?id=MPtOaenBIk5yzW9n7n9",
                userService.loadUserByUsername("https://www.google.com/accounts/o8/id?id=MPtOaenBIk5yzW9n7n9").getUsername());
    }
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.