org.springframework.security.web.savedrequest.RequestCache Java Examples
The following examples show how to use
org.springframework.security.web.savedrequest.RequestCache.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSecurityConfig.java From jeesupport with MIT License | 6 votes |
/** * 登陆成功后的处理 * * @return */ @Bean public AuthenticationSuccessHandler successHandler(){ return new AuthenticationSuccessHandler(){ @Override public void onAuthenticationSuccess( HttpServletRequest _request, HttpServletResponse _response, Authentication _auth ) throws IOException, ServletException{ log.debug( "--登陆成功" ); _request.getSession().setAttribute( ISupportEL.Session_User_EL, _auth.getPrincipal() ); sessionRegistry().registerNewSession( _request.getSession().getId(), _auth.getPrincipal() ); RequestCache requestCache = new HttpSessionRequestCache(); SavedRequest savedRequest = requestCache.getRequest( _request, _response ); String url = null; if( savedRequest != null ) url = savedRequest.getRedirectUrl(); log.debug( "--登陆后转向:" + url ); if( url == null ) redirectStrategy().sendRedirect( _request, _response, "/" ); else _response.sendRedirect( url ); } }; }
Example #2
Source File: SecurityHandlerConfig.java From open-capacity-platform with Apache License 2.0 | 6 votes |
/** * 登陆成功,返回Token 装配此bean不支持授权码模式 * * @return */ @Bean public AuthenticationSuccessHandler loginSuccessHandler() { return new SavedRequestAwareAuthenticationSuccessHandler() { private RequestCache requestCache = new HttpSessionRequestCache(); @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { super.onAuthenticationSuccess(request, response, authentication); return; } }; }
Example #3
Source File: PlayerFormLoginSuccessAuthenticationHandler.java From codenjoy with GNU General Public License v3.0 | 4 votes |
public void setRequestCache(RequestCache requestCache) { this.requestCache = requestCache; }
Example #4
Source File: MySavedRequestAwareAuthenticationSuccessHandler.java From tutorials with MIT License | 4 votes |
public void setRequestCache(final RequestCache requestCache) { this.requestCache = requestCache; }
Example #5
Source File: MySavedRequestAwareAuthenticationSuccessHandler.java From tutorials with MIT License | 4 votes |
public void setRequestCache(final RequestCache requestCache) { this.requestCache = requestCache; }
Example #6
Source File: MySavedRequestAwareAuthenticationSuccessHandler.java From tutorials with MIT License | 4 votes |
public void setRequestCache(final RequestCache requestCache) { this.requestCache = requestCache; }
Example #7
Source File: MySavedRequestAwareAuthenticationSuccessHandler.java From tutorials with MIT License | 4 votes |
public void setRequestCache(final RequestCache requestCache) { this.requestCache = requestCache; }
Example #8
Source File: MySavedRequestAwareAuthenticationSuccessHandler.java From springrest-angularjs with Apache License 2.0 | 4 votes |
public void setRequestCache(final RequestCache requestCache) { this.requestCache = requestCache; }
Example #9
Source File: STSUPAuthenticationProvider.java From cxf-fediz with Apache License 2.0 | 4 votes |
public void setRequestCache(RequestCache requestCache) { this.requestCache = requestCache; }
Example #10
Source File: SimpleSignInAdapter.java From lolibox with Apache License 2.0 | 4 votes |
@Inject public SimpleSignInAdapter(RequestCache requestCache) { this.requestCache = requestCache; }
Example #11
Source File: SavedRequestAwareAuthenticationSuccessHandler.java From zxl with Apache License 2.0 | 4 votes |
public void setRequestCache(RequestCache requestCache) { this.requestCache = requestCache; }
Example #12
Source File: PermissionAdapter.java From MaxKey with Apache License 2.0 | 4 votes |
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { _logger.trace("PermissionAdapter preHandle"); //save first protected url SavedRequest firstSavedRequest = (SavedRequest)WebContext.getAttribute(WebConstants.FIRST_SAVED_REQUEST_PARAMETER); // 判断用户是否登录, 判断用户和角色,判断用户是否登录用户 if (WebContext.getAuthentication() == null || WebContext.getAuthentication().getAuthorities() == null) { //保存未认证的请求信息 if(firstSavedRequest==null){ RequestCache requestCache = new HttpSessionRequestCache(); requestCache.saveRequest(request, response); SavedRequest savedRequest =requestCache.getRequest(request, response); if(savedRequest!=null){ _logger.debug("first request parameter savedRequest "+savedRequest.getRedirectUrl()); WebContext.setAttribute(WebConstants.FIRST_SAVED_REQUEST_PARAMETER, savedRequest); savedRequestSuccessHandler.setRequestCache(requestCache); } } _logger.trace("No Authentication ... forward to /login"); RequestDispatcher dispatcher = request.getRequestDispatcher("/login"); dispatcher.forward(request, response); return false; } //认证完成,跳转到未认证请求 if(firstSavedRequest!=null) { savedRequestSuccessHandler.onAuthenticationSuccess(request, response, WebContext.getAuthentication()); WebContext.removeAttribute(WebConstants.FIRST_SAVED_REQUEST_PARAMETER); } boolean hasAccess = true; /* * boolean preHandler = super.preHandle(request, response, handler); * * if(preHandler) { preHandler = false; * * * if(!preHandler){//无权限转向 * log.debug("You do not have permission to access "+accessUrl); * RequestDispatcher dispatcher = request.getRequestDispatcher("/accessdeny"); * dispatcher.forward(request, response); return false; } } */ return hasAccess; }
Example #13
Source File: RealAuthenticationFailureHandler.java From MaxKey with Apache License 2.0 | 4 votes |
public RealAuthenticationFailureHandler(RequestCache requestCache) { super(); this.requestCache = requestCache; }
Example #14
Source File: SavedRequestAwareAuthenticationSuccessHandler.java From MaxKey with Apache License 2.0 | 4 votes |
public void setRequestCache(RequestCache requestCache) { this.requestCache = requestCache; }
Example #15
Source File: MyAuthenticationSuccessHandler.java From springboot-security-wechat with Apache License 2.0 | 4 votes |
public void setRequestCache(RequestCache requestCache) { this.requestCache = requestCache; }
Example #16
Source File: MyAuthenticationSuccessHandler.java From SpringMango with Apache License 2.0 | 4 votes |
public void setRequestCache(RequestCache requestCache) { this.requestCache = requestCache; }
Example #17
Source File: MyAuthenticationSuccessHandler.java From SpringMango with Apache License 2.0 | 4 votes |
public RequestCache getRequestCache() { return requestCache; }
Example #18
Source File: SecurityConfig.java From promregator with Apache License 2.0 | 4 votes |
private RequestCache newHttpSessionRequestCache() { HttpSessionRequestCache httpSessionRequestCache = new HttpSessionRequestCache(); httpSessionRequestCache.setCreateSessionAllowed(false); return httpSessionRequestCache; }