I have an OpenID Connect Identity Provider Processor for my Sitecore 9.0.1 site which is using federated authentication as described in Sitecore's documentation. I'm also generating the sign-in links as per this documentation. This is currently working fine, however there is a change which requires us to use different OpenIdConnectAuthenticationOptions
within the same site based on a certain condition. My plan was to use App.MapWhen
with my conditions and specify the correct options inside each. However even using App.MapWhen
with a single condition which is always true like this does not work:
protected override void ProcessCore([NotNull] IdentityProvidersArgs args)
{
args.App.MapWhen(context => true, app =>
{
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
//my OIDC options
});
});
}
When I try to login now a 404 is thrown on the post from the login button to /identity/externallogin
, this works fine without the App.MapWhen
I understand Sitecore puts in middleware and what I'm doing might conflict with this. How do I use different OIDC options within the same site?