org.springframework.security.web.savedrequest.RequestCache.removeRequest()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.springframework.security.web.savedrequest.RequestCache.removeRequest方法的一些代码示例,展示了RequestCache.removeRequest的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestCache.removeRequest方法的具体详情如下:
包路径:org.springframework.security.web.savedrequest.RequestCache
类名称:RequestCache
方法名:removeRequest

RequestCache.removeRequest介绍

[英]Removes the cached request.
[中]删除缓存的请求。

代码示例

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

requestCache.removeRequest(request, response);
super.onAuthenticationSuccess(request, response, authentication);
return;

代码示例来源:origin: spring-projects/spring-security

if (savedRequest != null) {
  redirectUrl = savedRequest.getRedirectUrl();
  this.requestCache.removeRequest(request, response);

代码示例来源:origin: infiniteautomation/ma-core-public

@Override
  public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
    User user = (User) authentication.getPrincipal();

    for (AuthenticationDefinition def : ModuleRegistry.getDefinitions(AuthenticationDefinition.class)) {
      def.authenticationSuccess(authentication, user);
    }

    if (browserHtmlRequestMatcher.matches(request)) {
      super.onAuthenticationSuccess(request, response, authentication);
    } else {
      requestCache.removeRequest(request, response);
      clearAuthenticationAttributes(request);

      // forward the request on to its usual destination (e.g. /rest/v1/login) so the correct response is returned
      request.getRequestDispatcher(request.getRequestURI()).forward(request, response);
    }
  }
}

代码示例来源:origin: chocotan/lolibox

private String extractOriginalUrl(NativeWebRequest request) {
  HttpServletRequest nativeReq = request.getNativeRequest(HttpServletRequest.class);
  HttpServletResponse nativeRes = request.getNativeResponse(HttpServletResponse.class);
  SavedRequest saved = requestCache.getRequest(nativeReq, nativeRes);
  if (saved == null) {
    return null;
  }
  requestCache.removeRequest(nativeReq, nativeRes);
  removeAutheticationAttributes(nativeReq.getSession(false));
  return saved.getRedirectUrl();
}

代码示例来源:origin: metatron-app/metatron-discovery

|| (targetUrlParameter != null && org.springframework.util.StringUtils.hasText(request
   .getParameter(targetUrlParameter)))) {
requestCache.removeRequest(request, response);
super.onAuthenticationSuccess(request, response, authentication);

代码示例来源:origin: gravitee-io/graviteeio-access-management

requestCache.removeRequest(request, response);
super.onAuthenticationSuccess(request, response, authentication);

代码示例来源:origin: fluxtream/fluxtream-app

savedRequest.getRedirectUrl().indexOf(env.get("release"))!=-1||
savedRequest.getRedirectUrl().indexOf("static/")!=-1) {
requestCache.removeRequest(request, response);
getRedirectStrategy().sendRedirect(request, response, getDefaultTargetUrl());
return;

代码示例来源:origin: luotuo/springboot-security-wechat

public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
  SavedRequest savedRequest = this.requestCache.getRequest(request, response);
  if(savedRequest == null) {
    //super.onAuthenticationSuccess(request, response, authentication);
    handle(request, response, authentication);
    super.clearAuthenticationAttributes(request);
  } else {
    String targetUrlParameter = this.getTargetUrlParameter();
    if(!this.isAlwaysUseDefaultTargetUrl() && (targetUrlParameter == null || !StringUtils.hasText(request.getParameter(targetUrlParameter)))) {
      this.clearAuthenticationAttributes(request);
      String targetUrl = savedRequest.getRedirectUrl();
      this.logger.debug("Redirecting to DefaultSavedRequest Url: " + targetUrl);
      //this.getRedirectStrategy().sendRedirect(request, response, targetUrl);
    } else {
      this.requestCache.removeRequest(request, response);
      //super.onAuthenticationSuccess(request, response, authentication);
      handle(request, response, authentication);
      super.clearAuthenticationAttributes(request);
    }
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public void onAuthenticationSuccess(HttpServletRequest request,
    HttpServletResponse response, Authentication authentication)
    throws ServletException, IOException {
  SavedRequest savedRequest = requestCache.getRequest(request, response);
  if (savedRequest == null) {
    super.onAuthenticationSuccess(request, response, authentication);
    return;
  }
  String targetUrlParameter = getTargetUrlParameter();
  if (isAlwaysUseDefaultTargetUrl()
      || (targetUrlParameter != null && StringUtils.hasText(request
          .getParameter(targetUrlParameter)))) {
    requestCache.removeRequest(request, response);
    super.onAuthenticationSuccess(request, response, authentication);
    return;
  }
  clearAuthenticationAttributes(request);
  // Use the DefaultSavedRequest URL
  String targetUrl = savedRequest.getRedirectUrl();
  logger.debug("Redirecting to DefaultSavedRequest Url: " + targetUrl);
  getRedirectStrategy().sendRedirect(request, response, targetUrl);
}

代码示例来源:origin: peholmst/vaadin4spring

@Override
public void onAuthenticationSuccess(Authentication authentication) throws Exception {
  HttpServletRequest request = http.getCurrentRequest();
  HttpServletResponse response = http.getCurrentResponse();
  SavedRequest savedRequest = requestCache.getRequest(request, response);
  if (savedRequest == null) {
    super.onAuthenticationSuccess(authentication);
    return;
  }
  String targetUrlParameter = getTargetUrlParameter();
  if (isAlwaysUseDefaultTargetUrl() || (targetUrlParameter != null && StringUtils.hasText(request.getParameter(targetUrlParameter)))) {
    requestCache.removeRequest(request, response);
    super.onAuthenticationSuccess(authentication);
    return;
  }
  clearAuthenticationAttributes();
  // Use the DefaultSavedRequest URL
  String targetUrl = savedRequest.getRedirectUrl();
  logger.debug("Redirecting to saved request redirect url: " + targetUrl);
  redirectStrategy.sendRedirect(targetUrl);
}

代码示例来源:origin: org.vaadin.spring.extensions/vaadin-spring-ext-security

@Override
public void onAuthenticationSuccess(Authentication authentication) throws Exception {
  HttpServletRequest request = http.getCurrentRequest();
  HttpServletResponse response = http.getCurrentResponse();
  SavedRequest savedRequest = requestCache.getRequest(request, response);
  if (savedRequest == null) {
    super.onAuthenticationSuccess(authentication);
    return;
  }
  String targetUrlParameter = getTargetUrlParameter();
  if (isAlwaysUseDefaultTargetUrl() || (targetUrlParameter != null && StringUtils.hasText(request.getParameter(targetUrlParameter)))) {
    requestCache.removeRequest(request, response);
    super.onAuthenticationSuccess(authentication);
    return;
  }
  clearAuthenticationAttributes();
  // Use the DefaultSavedRequest URL
  String targetUrl = savedRequest.getRedirectUrl();
  logger.debug("Redirecting to saved request redirect url: " + targetUrl);
  redirectStrategy.sendRedirect(targetUrl);
}

代码示例来源:origin: org.vaadin.spring/spring-vaadin-security

@Override
public void onAuthenticationSuccess(Authentication authentication) throws Exception {
  HttpServletRequest request = http.getCurrentRequest();
  HttpServletResponse response = http.getCurrentResponse();
  
  SavedRequest savedRequest = requestCache.getRequest(request, response);
  if (savedRequest == null) {
    super.onAuthenticationSuccess(authentication);
    return;
  }
  String targetUrlParameter = getTargetUrlParameter();
  if (isAlwaysUseDefaultTargetUrl() || (targetUrlParameter != null && StringUtils.hasText(request.getParameter(targetUrlParameter)))) {
    requestCache.removeRequest(request, response);
    super.onAuthenticationSuccess(authentication);
    return;
  }
  clearAuthenticationAttributes();
  // Use the DefaultSavedRequest URL
  String targetUrl = savedRequest.getRedirectUrl();
  logger.debug("Redirecting to DefaultSavedRequest Url: " + targetUrl);
  getRedirectStrategy().sendRedirect(targetUrl);
  
}

代码示例来源:origin: apache/servicemix-bundles

if (savedRequest != null) {
  redirectUrl = savedRequest.getRedirectUrl();
  this.requestCache.removeRequest(request, response);

相关文章

微信公众号

最新文章

更多