We have established the SSO between Hybris C4C and Hybris commerce (ASM) with MS-ADFS as IDP. The entire flow works fine.
There is a specific use case where if in any case, the C4C agent does not have permissions to access the ASM as an asagent, they must be redirected to the homepage with asm component active so that they may try to access the ASM separately.
Due to the best practice constraints, we are not changing the samlsinglesignon RedirectionController, but I have written my own controller.
To redirect to the new controller, I have injected the following property in the spring-security-config.xml
<bean id="successRedirectHandler"
class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler">
<property name="defaultTargetUrl" value="https://domain/sso/adfs"/>
</bean>
The issue is, after successful authentication from IDP, whenever the call is getting redirected to the new controller, there is a null pointer exception - The authentication attributes are null.
I am not able to understand that if I redirect to the original controller, then the authentication is not null, but if I redirect to the new controller, the authentication is not present.
Any help in this regard would greatly be appreciated.