Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.AuthenticationTrustResolver


            user.setConfirmPassword(user.getPassword());

            // if user logged in with remember me, display a warning that they can't change passwords
            log.debug("checking for remember me login...");

            AuthenticationTrustResolver resolver = new AuthenticationTrustResolverImpl();
            SecurityContext ctx = SecurityContextHolder.getContext();

            if (ctx != null) {
                Authentication auth = ctx.getAuthentication();

                if (resolver.isRememberMe(auth)) {
                    getSession().setAttribute("cookieLogin", "true");
                    saveMessage(getText("userProfile.cookieLogin"));
                }
            }
        }
View Full Code Here


                }
            }

            User user = (User) args[0];

            AuthenticationTrustResolver resolver = new AuthenticationTrustResolverImpl();
            // allow new users to signup - this is OK b/c Signup doesn't allow setting of roles
            boolean signupUser = resolver.isAnonymous(auth);

            if (!signupUser) {
                UserManager userManager = (UserManager) target;
                User currentUser = getCurrentUser(auth, userManager);
View Full Code Here

        User user = (User) args[0];

        if (user.getVersion() != null) {
            // reset the authentication object if current user
            Authentication auth = SecurityContextHolder.getContext().getAuthentication();
            AuthenticationTrustResolver resolver = new AuthenticationTrustResolverImpl();
            // allow new users to signup - this is OK b/c Signup doesn't allow setting of roles
            boolean signupUser = resolver.isAnonymous(auth);
            if (auth != null && !signupUser) {
                UserManager userManager = (UserManager) target;
                User currentUser = getCurrentUser(auth, userManager);
                if (currentUser.getId().equals(user.getId())) {
                    auth = new UsernamePasswordAuthenticationToken(user, user.getPassword(), user.getAuthorities());
View Full Code Here

            }
        }
    }

    private boolean isAnonymous() {
        AuthenticationTrustResolver resolver = new AuthenticationTrustResolverImpl();
        SecurityContext ctx = SecurityContextHolder.getContext();
        if (ctx != null) {
            Authentication auth = ctx.getAuthentication();
            return resolver.isAnonymous(auth);
        }
        return true;
    }
View Full Code Here

        AuthenticationEntryPoint authenticationEntryPoint = exceptionConf == null ? null : exceptionConf.getAuthenticationEntryPoint(http);
        securityContextRequestFilter.setAuthenticationEntryPoint(authenticationEntryPoint);
        LogoutConfigurer<H> logoutConf = http.getConfigurer(LogoutConfigurer.class);
        List<LogoutHandler> logoutHandlers = logoutConf == null ? null : logoutConf.getLogoutHandlers();
        securityContextRequestFilter.setLogoutHandlers(logoutHandlers);
        AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
        if(trustResolver != null) {
            securityContextRequestFilter.setTrustResolver(trustResolver);
        }
        securityContextRequestFilter = postProcess(securityContextRequestFilter);
        http.addFilter(securityContextRequestFilter);
View Full Code Here

        contextToSave.setAuthentication(testToken);
        HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
        MockHttpServletRequest request = new MockHttpServletRequest();
        HttpRequestResponseHolder holder = new HttpRequestResponseHolder(request, new MockHttpServletResponse());
        repo.loadContext(holder);
        AuthenticationTrustResolver trustResolver = mock(AuthenticationTrustResolver.class);
        repo.setTrustResolver(trustResolver);

        repo.saveContext(contextToSave, holder.getRequest(), holder.getResponse());

        verify(trustResolver).isAnonymous(contextToSave.getAuthentication());
View Full Code Here

                http.setSharedObject(SecurityContextRepository.class, new NullSecurityContextRepository());
            } else {
                HttpSessionSecurityContextRepository httpSecurityRepository = new HttpSessionSecurityContextRepository();
                httpSecurityRepository.setDisableUrlRewriting(!enableSessionUrlRewriting);
                httpSecurityRepository.setAllowSessionCreation(isAllowSessionCreation());
                AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
                if(trustResolver != null) {
                    httpSecurityRepository.setTrustResolver(trustResolver);
                }
                http.setSharedObject(SecurityContextRepository.class, httpSecurityRepository);
            }
View Full Code Here

            sessionManagementFilter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler(sessionAuthenticationErrorUrl));
        }
        if(invalidSessionUrl != null) {
            sessionManagementFilter.setInvalidSessionStrategy(getInvalidSessionStrategy());
        }
        AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
        if(trustResolver != null) {
            sessionManagementFilter.setTrustResolver(trustResolver);
        }
        sessionManagementFilter = postProcess(sessionManagementFilter);
View Full Code Here

    }

    private SecurityExpressionHandler<FilterInvocation> getExpressionHandler(H http) {
        if(expressionHandler == null) {
            DefaultWebSecurityExpressionHandler defaultHandler = new DefaultWebSecurityExpressionHandler();
            AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
            if(trustResolver != null) {
                defaultHandler.setTrustResolver(trustResolver);
            }
            expressionHandler = postProcess(defaultHandler);
        }
View Full Code Here

        assertEquals("/timedOut", response.getRedirectedUrl());
    }

    @Test
    public void customAuthenticationTrustResolver() throws Exception {
        AuthenticationTrustResolver trustResolver= mock(AuthenticationTrustResolver.class);
        SecurityContextRepository repo = mock(SecurityContextRepository.class);
        SessionManagementFilter filter = new SessionManagementFilter(repo);
        filter.setTrustResolver(trustResolver);
        HttpServletRequest request = new MockHttpServletRequest();
        authenticateUser();
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.AuthenticationTrustResolver

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.