Search code examples
sustainsys-saml2

Why are deep links not working after authentication?


After authenticating, the user is always sent to the root url of the application, even though they initially requested a deep link.

I've read that there is a concept of RelayState, however I'm not sure if that is something I need to explicitly look for as a property somewhere and then redirect, or something that should be functioning automatically if I have things setup correctly.

I have tried tacking on a url to the signOn url but that didn't seem to have any affect. This is just when I manually enter a url in the browser, though, so I assume that isn't an "SP initiated login"

When I need to authenticate I am redirecting to a deep link like so (hard coded just while trying to debug)

string deepLink = "?returnUrl=http://localhost:35246" + app.Context.Request.FilePath;
string logInPage = "~/Saml2/SignIn" + deepLink;
HttpContext.Current.Response.Redirect(logInPage);

The logging output shows this.. should SignInUrl show something different?

SUSTAINSYS [VERBOSE] Expanded Saml2Url
  AssertionConsumerServiceUrl: http://localhost:35245/Saml2/Acs
  SignInUrl: http://localhost:35245/Saml2/SignIn
  LogoutUrl: http://localhost:35245/Saml2/Logout
  ApplicationUrl: http://localhost:35245/

Any pointers?


Solution

  • it needs to be

    ?ReturnUrl=
    

    rather than

    ?returnUrl=