DuendeSoftware / Samples

Samples for our Products
Other
225 stars 269 forks source link

Dynamic providers sample - user is not authenticated in the MVC client app #128

Closed Newmski closed 1 year ago

Newmski commented 1 year ago

I am trying to run the dynamic providers sample and am unable to get the Secure link to work from the MVC client application.

I have followed the instructions to seed the database.

Steps to replicate my issue:

I can see that the login has succeeded because Bobs id appears in the header of the IDP however I would expect to redirected back to the client application at this point which it is not happening.

If I manually navigate back to the client (https://localhost:44300/) and click the Secure link again I get redirected back to the IDP.

josephdecock commented 1 year ago

This is happening because the client application in the sample is requesting a particular idp (adfs) using the acr_values parameter. Since you're not using the adfs provider, identity server shows the login screen again. I think this is a bug in our sample, because the sample seed data doesn't include the adfs provider. If you remove the following from the client's startup.cs file, it should work:

                    options.Events.OnRedirectToIdentityProvider = ctx => 
                    {
                        ctx.ProtocolMessage.AcrValues = "idp:adfs";
                        return Task.CompletedTask;
                    };