Spring Security - Retaining URL parameters on redirect to login

后端 未结 4 845
攒了一身酷
攒了一身酷 2020-12-08 20:23

ok.

lets say I have a secure url pattern

/secure/link-profile

optionally, there can be url paramaters appended.

/se         


        
4条回答
  •  Happy的楠姐
    2020-12-08 21:04

    See the method buildRedirectUrlToLoginPage(HttpServletRequest request, ...) in LoginUrlAuthenticationEntryPoint.

    If I understood correctly what you want to achieve, I think it should be enough to override this method in a sublclass, copy the original method, but additionally call urlBuilder.setQuery(request.getQueryString()) when it builds the url.

    Then you only need to configure the ExceptionTranslationFilter with this customized entry point.

提交回复
热议问题