Solved !!! The solution stay in this article . Please, if possible upvote this issue on spring-security to help us to extends the funcionality of CasAuthenticationProvider, the link
CAS with SavedRequestAwareAuthenticationSuccessHandler no redirecting correctly
-
30-07-2022 - |
Question
I'm trying solve a problem using CAS with Spring Security, when I do a link to another url that use to the same CAS Server.
I tried change the SimpleURLAuthenticationSuccess by SavedRequestAwareAuthenticationSuccessHandler like in this link but still not working.
To show better my scenario is:
I have two applications running in the same CAS Server. When I access the application 1, then I goes to the CAS Server. After logIn I access the context of application normally.
The problem occur when I try access application 2 through the following link
<a href="/applicationB/pages/motors/1"/>
I'm redirected to CAS and CAS redirect me to /applicationB, context of application.
According with this link, I simply should change the bean SimpleURLAuthenticationSuccess by SavedRequestAwareAuthenticationSuccessHandler
Edited
I saw that maybe the solution isn't use SavedRequestAwareAuthenticationSuccessHandler, because, the CasAuthenticationFilter extends AbstractAuthenticationProcessingFilter and this class have the following method:
/**
* Sets the strategy used to handle a successful authentication.
* By default a {@link SavedRequestAwareAuthenticationSuccessHandler} is used.
*/
public void setAuthenticationSuccessHandler(AuthenticationSuccessHandler successHandler) {
Assert.notNull(successHandler, "successHandler cannot be null");
this.successHandler = successHandler;
}
Solution