2

I have an identity server configured which our Asp.Net Core website uses for authentication. When we issue a challenge in the website, it obviously gets picked up in the Challenge controller action in External Controller in ID server. If I add authentication properties to the website challenge, I can't see how to retrieve them in challenge controller action in ID server. Does anyone know how I can do this? I need to pass information from the website challenge to ID server.

doogdeb
  • 400
  • 3
  • 8

1 Answers1

0

If anyone else has wondered how to do this, I managed to fix it by doing the following in the client within .AddOpenIdConnect.

options.Events.OnRedirectToIdentityProvider = async context =>
                    {                          
                        context.ProtocolMessage.AcrValues = "YourKey:YourValue";
                        await Task.FromResult(0);
                    };    

Then in the identity servers Challenge controller action in ExternalController, you can retrieve the values like this.

var authorizationContext = await _interaction.GetAuthorizationContextAsync(returnUrl);
        if (authorizationContext.AcrValues.Contains("YourKey"))
        {
             props.Items.Add(authorizationContext.AcrValues["YourKey"]);
        }
doogdeb
  • 400
  • 3
  • 8