Package org.springframework.security.userdetails

Examples of org.springframework.security.userdetails.UserDetails


    {
        final JaasAuthenticationProvider provider = context.mock(JaasAuthenticationProvider.class);
        final JaasAuthenticationToken token = context.mock(JaasAuthenticationToken.class);
        final UsernamePasswordAuthenticationToken auth = context.mock(UsernamePasswordAuthenticationToken.class);
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final UserDetails ud = context.mock(UserDetails.class);
       
        context.checking(new Expectations()
        {
            {
                //start parent class mock
View Full Code Here


    public void testAuthenticate()
    {
        final UsernamePasswordAuthenticationToken auth =
            context.mock(UsernamePasswordAuthenticationToken.class);
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final UserDetails ud = context.mock(UserDetails.class);
        final UserDetailsChecker checker = context.mock(UserDetailsChecker.class);

        context.checking(new Expectations()
        {
            {
View Full Code Here

    @Test
    public void testMapUserFromContext()
    {
        final UserDetailsServiceImpl svc = context.mock(UserDetailsServiceImpl.class);
        final UserDetailsChecker udc = context.mock(UserDetailsChecker.class);
        final UserDetails ud = context.mock(UserDetails.class);
               
        context.checking(new Expectations()
        {
            {
                oneOf(svc).loadUserByUsername(with("username"));
View Full Code Here

     * Test mapper is called correctly.
     */
    @Test
    public void testOnLoginSuccess()
    {
        final UserDetails userDetails = context.mock(UserDetails.class);
        final PersistentLoginRepository loginRepo = context
                .mock(PersistentLoginRepository.class);
        final UserDetailsService userDetailsService = context
                .mock(UserDetailsService.class);
        final HttpServletRequest request = context
View Full Code Here

     * Test mapper not called with empty username.
     */
    @Test
    public void testOnLoginSuccessEmptyUsername()
    {
        final UserDetails userDetails = context.mock(UserDetails.class);
        final PersistentLoginRepository loginRepo = context
                .mock(PersistentLoginRepository.class);
        final UserDetailsService userDetailsService = context
                .mock(UserDetailsService.class);
        final HttpServletRequest request = context
View Full Code Here

     * exception.
     */
    @Test
    public void testOnLoginSuccessRepositoryException()
    {
        final UserDetails userDetails = context.mock(UserDetails.class);
        final PersistentLoginRepository loginRepo = context
                .mock(PersistentLoginRepository.class);
        final UserDetailsService userDetailsService = context
                .mock(UserDetailsService.class);
        final HttpServletRequest request = context
View Full Code Here

        final HttpServletRequest request = context
                .mock(HttpServletRequest.class);
        final HttpServletResponse response = context
                .mock(HttpServletResponse.class);
        final Authentication auth = context.mock(Authentication.class);
        final UserDetails userDetails = context.mock(UserDetails.class);
        final PersistentLoginRepository loginRepo = context
                .mock(PersistentLoginRepository.class);
        final UserDetailsService userDetailsService = context
                .mock(UserDetailsService.class);
View Full Code Here

            }
        });

        UserDetailsServiceImpl sut = new UserDetailsServiceImpl(personMapper, loginRepo, authProvider,
                serviceActionController, createUserfromLdapAction);
        UserDetails result = sut.loadUserByUsername("username");
        assertNotNull("Should return UserDetailsObject", result);
        assertEquals(1, result.getAuthorities().length);
        context.assertIsSatisfied();
    }
View Full Code Here

    {
        response.setContentType("text/plain");

        springContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());

        UserDetails userDetails = getUserDetails();
        T domainEntity = getDomainEntity(userDetails.getUsername(), request);

        HashGeneratorStrategy hasher = new HashGeneratorStrategy();
        String imageId = hasher.hash(String.valueOf(domainEntity.getId()));

        try
        {
            FileItem uploadItem = getFileItem(request);

            if (uploadItem == null)
            {
                response.getWriter().write("fail");
                return;
            }

            // Save the File

            Object actionBean = getAction(request);

            T newDomainEntity = null;

            if (actionBean instanceof ServiceAction || actionBean instanceof TaskHandlerServiceAction)
            {
                SaveImageRequest currentRequest = new SaveImageRequest(uploadItem, domainEntity.getId(), imageId);
                ActionController serviceActionController = (ActionController) springContext
                        .getBean("serviceActionController");
                DefaultPrincipal principal = new DefaultPrincipal(userDetails.getUsername(),
                        ((ExtendedUserDetails) userDetails).getPerson().getOpenSocialId(),
                        ((ExtendedUserDetails) userDetails).getPerson().getId());
                ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principal);

                if (actionBean instanceof ServiceAction)
View Full Code Here

     *
     * @return the uesr details
     */
    private UserDetails getUserDetails()
    {
        UserDetails user = null;
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        if (null != auth)
        {
            Object obj = auth.getPrincipal();
            if (obj instanceof UserDetails)
View Full Code Here

TOP

Related Classes of org.springframework.security.userdetails.UserDetails

Copyright © 2018 www.massapicom. 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.