JavaHead
JavaHead

Reputation: 673

Spring SAML Okta - How to redirect to a custom URL in IDP initiated flow

My application's entry point is a custom URL , how do I tell Spring to redirect to my URL after a successful SAML dance ? I am using IDP initiated flow.

In my app. I have several versions defined depending on a client.

e.g Client abc goes to https:\localhost:8443\abc\admin and client xyz goes to https:\localhost:8443\xyz\admin

thanks

Upvotes: 0

Views: 919

Answers (1)

JavaHead
JavaHead

Reputation: 673

Turns out there is a handler called SAMLRelayStateSuccessHandler which redirects to an endpoint defined in "Default Relay State" configuration item in Okta (application configuration).

So first thing go to Okta and specify a redirect URL in "Default Relay State" property. Then add this property to SAMLProcessingFilter :

 samlWebSSOProcessingFilter.setAuthenticationSuccessHandler(new SAMLRelayStateSuccessHandler());

and once Spring-SAML authenticates successfully it'll redirect to your relay URL.

Upvotes: 1

Related Questions