Spring Security conditional default-target-url

后端 未结 2 1418
慢半拍i
慢半拍i 2021-02-05 16:00

I\'ve noticed that there are a couple of questions asking about this topic. I looked through them and I was unable to apply them to my specific Spring setup. I would like to con

2条回答
  •  悲&欢浪女
    2021-02-05 16:25

    A more appropriate approach IMO is to create a class which extends SimpleUrlAuthenticationSuccessHandler, and then override its determineTargetUrl method. From the docs:

    Builds the target URL according to the logic defined in the main class Javadoc.

    ...which sounds a little confusing, but basically you write whatever logic you need to determine the target URL, then just return it as a String.

提交回复
热议问题