我使用 Spring Security 进行了 OpenID 和 SAML 集成。我正在使用服务启动的流程。我想在身份验证发生后将初始 URL 中存在的任何查询参数一直传递到最终重定向。
示例流程为:
localhost:8080/auth-server/openid?param1=value1
localhost:8080/auth-server/oauth2/authorization/registrationId
(这是OAuth2AuthorizationRequestRedirectFilter.DEFAULT_AUTHORIZATION_REQUEST_BASE_URI
中的默认网址)https://idpurl.com/myAppId?params...
localhost:8080/auth-server/login/oauth2/code/registrationId?params...
localhost:8080/auth-server/openid
只是这一次,没有 param1
。我正在寻找一种方法来将
param1
一路传递到最终重定向。 Spring Security 支持吗?有没有简单的方法可以做到这一点?
开箱即用的解决方案是使用
SavedRequestAwareAuthenticationSuccessHandler
保存原始请求并在身份验证成功后重播以进行最终重定向。