I have an OpenID and SAML integration using Spring Security. I'm using the service initiated flow. I would like to pass any query parameter that is present in the initial URL, all the way to the final redirect, after authentication has taken place.
Example flow would be:
localhost:8080/auth-server/openid?param1=value1
localhost:8080/auth-server/oauth2/authorization/registrationId
(this is the default url in 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
only this time, there is no param1
.I'm looking for a way to pass param1
all the way to the final redirection. Is this supported in Spring Security? Is there a simple way to do this?
The out of the box solution is to use the SavedRequestAwareAuthenticationSuccessHandler
which saves the original request and replays it after authentication is successful for the final redirect.