Example usage for org.springframework.security.web.savedrequest HttpSessionRequestCache HttpSessionRequestCache

List of usage examples for org.springframework.security.web.savedrequest HttpSessionRequestCache HttpSessionRequestCache

Introduction

In this page you can find the example usage for org.springframework.security.web.savedrequest HttpSessionRequestCache HttpSessionRequestCache.

Prototype

HttpSessionRequestCache

Source Link

Usage

From source file:net.gplatform.sudoor.server.social.config.SocialConfig.java

@Bean
public RequestCache requestCache() {
    return new HttpSessionRequestCache();
}

From source file:com.hp.autonomy.frontend.find.core.beanconfiguration.SecurityConfiguration.java

@SuppressWarnings("ProhibitedExceptionDeclared")
@Override//from   w  ww .j ava2  s  .  c om
protected void configure(final HttpSecurity http) throws Exception {
    final HttpSessionRequestCache requestCache = new HttpSessionRequestCache();
    requestCache.setRequestMatcher(new AntPathRequestMatcher(FindController.APP_PATH));

    http.authorizeRequests().antMatchers("/api/public/**").hasRole(FindRole.USER.name())
            .antMatchers("/api/admin/**").hasRole(FindRole.ADMIN.name()).antMatchers("/api/config/**")
            .hasRole(FindRole.CONFIG.name()).antMatchers("/api/bi/**").hasRole(FindRole.BI.name()).and()
            .requestCache().requestCache(requestCache).and().csrf().disable().headers().defaultsDisabled()
            .frameOptions().sameOrigin();
}

From source file:org.craftercms.security.processors.impl.SavedRequestAwareProcessor.java

public SavedRequestAwareProcessor() {
    requestCache = new HttpSessionRequestCache();
}

From source file:csns.security.AuthenticationSuccessHandler.java

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws ServletException, IOException {
    User user = (User) authentication.getPrincipal();
    logger.info(user.getUsername() + " signed in from " + request.getRemoteAddr());

    RequestCache requestCache = new HttpSessionRequestCache();
    SavedRequest savedRequest = requestCache.getRequest(request, response);
    if (savedRequest != null) {
        super.onAuthenticationSuccess(request, response, authentication);
        return;/*from  w  w  w. j a  v  a  2s  .  c  o  m*/
    }

    getRedirectStrategy().sendRedirect(request, response, defaultUrls.userHomeUrl(request));
}

From source file:bookpub.security.AuthenticationSuccessHandler.java

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws ServletException, IOException {
    User user = (User) authentication.getPrincipal();
    logger.info(user.getUsername() + " signed in.");

    RequestCache requestCache = new HttpSessionRequestCache();
    SavedRequest savedRequest = requestCache.getRequest(request, response);
    if (savedRequest != null) {
        super.onAuthenticationSuccess(request, response, authentication);
        return;//w w w.j a  v  a 2s.  c  om
    }

    if (request.getParameter("mobile") != null)
        objectMapper.writeValue(response.getWriter(), new ServiceResponse());
    else
        getRedirectStrategy().sendRedirect(request, response, "/");
}

From source file:edu.csula.squirrels.security.AuthenticationSuccessHandler.java

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
        Authentication authentication) throws ServletException, IOException {
    User user = (User) authentication.getPrincipal();
    logger.info(user.getUsername() + " signed in.");

    RequestCache requestCache = new HttpSessionRequestCache();
    SavedRequest savedRequest = requestCache.getRequest(request, response);
    if (savedRequest != null) {
        super.onAuthenticationSuccess(request, response, authentication);
        return;/*from  ww  w .j  a  va 2s  .c o  m*/
    }

    if (request.getParameter("mobile") != null)
        objectMapper.writeValue(response.getWriter(), new ServiceResponse("loggedIn"));
    else
        getRedirectStrategy().sendRedirect(request, response, "/");
}

From source file:org.craftercms.security.authentication.impl.AuthenticationRequiredHandlerImpl.java

/**
 * Default constructor
 */
public AuthenticationRequiredHandlerImpl() {
    super();
    requestCache = new HttpSessionRequestCache();
}

From source file:org.craftercms.security.authentication.impl.LoginSuccessHandlerImpl.java

public LoginSuccessHandlerImpl() {
    super();
    requestCache = new HttpSessionRequestCache();
    alwaysUseDefaultTargetUrl = false;
}

From source file:de.dlopes.stocks.facilitator.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {

    // retrieve configured contextPath for dispatcher servlet
    String cxtpth = config.getDispatcherServletCxtpth();

    http.formLogin().loginPage(cxtpth + "/login").loginProcessingUrl(cxtpth + "/loginProcess")
            .defaultSuccessUrl(cxtpth + "/stock-info").failureUrl(cxtpth + "/login?login_error=1").and()
            .logout().logoutUrl(cxtpth + "/logout").logoutSuccessUrl(cxtpth + "/index")

            // Disable CSRF (won't work with JSF) but ensure last HTTP POST request is saved
            // See https://jira.springsource.org/browse/SEC-2498

            .and().csrf().disable().requestCache().requestCache(new HttpSessionRequestCache());

}

From source file:com.greglturnquist.spring.social.ecobee.SocialConfig.java

@Bean
public SignInAdapter signInAdapter() {
    return new SimpleSignInAdapter(new HttpSessionRequestCache());
}