Okta integration with ASPNet Core 3.1 Identity

Hello,
I have a .Net Core 3.1 Web Application (MVC) which had initially been built using Microsoft.AspNetCore.Identity. Users are currently are managed within this application. The associated DB contains all the AspNetUsers, AspNetRoles, etc… tables.

I now need SSO using SAML2.0. Okta has a great example that I do have working: https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp

I am attempting to integrate this with my web application but am having difficulty I still require the web application to support the initial Microsoft.AspNetCore.Identity authentication and the Okta integration. I seem to be able to do one or the other but not both.

I am at a point where I believe the [Authorize] attribute is giving me a problem since it is not setting the User.Identity.IsAuthenticated value to True even though I was able to have the web application sign me onto to Okta. I get the following error:

Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed.

Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler: Information: AuthenticationScheme: Identity.Application was challenged.

This makes me believe that the [Authorize] attribute is still expecting the me to sign in using Microsoft.AspNetCore.Identity authentication (the initial implementation of the web application that still allows me to successfully log on).

I wonder if I need to customize the [Authorize] attribute to get this to work.

Does anyone have any working samples that they are willing to share?

Many thanks,

Steve

Hi sdwyer,

Did you ever get an answer or figured this out?