Forums, Documentation & Knowledge Base - ComponentSpace

[Authorize] attribute does not populate RedirectUri in challenge's authenticationProperties


https://www.componentspace.com/forums/Topic11740.aspx

By leo_eoc - 9/10/2021

I'm trying to get saml middleware to work with basic cookie authentication (not AddDefaultIdentity() as in the middleware sample)
The saml flow completes OK, and the cookie auth scheme signs in succesfully. So far so good.

However, when triggering a challenge using the [Authorize] attribute on a controller action, the final redirect back to that same controller action does not happen.
In the debug log I see that the saml middleware HandleChallengeAsync() method did not receive a redirect uri as part of the authenticationProperties parameter.
Also the relayState parameter of the LoginCompletionUrl() callback is null.

What am I doing wrong here?


I'm using .NET Core 2.1 and ComponentSpace.Saml 3.7.0
excerpt of Startup.cs:

   services.AddAuthentication(options =>
    {
      options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    })
    .AddCookie(options =>
    {
      options.ForwardChallenge = SamlAuthenticationDefaults.AuthenticationScheme;
    })
    .AddSaml(options =>
      {
       options.PartnerName = (httpContext) => Configuration["PartnerName"];
       options.AssertionConsumerServicePath = "/saml2/acs";
       options.LoginCompletionUrl = (context, relayState) =>
       {
        return relayState;
       };
       options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
      });


Excerpt of controller action:

 [Authorize(AuthenticationSchemes = CookieAuthenticationDefaults.AuthenticationScheme)]
    public async Task<IActionResult> TestMethod()
   {
   }

thanks in advance for any help!
By ComponentSpace - 9/20/2021

Thank you for your kind words.