Open PavelBansky opened 4 years ago
Thank you for reporting the issue, we'll look at what has changed.
I think I resolved it.
First issue:
The template for project has incorrect version of Microsoft.AspNetCore.Authentication.OpenIdConnect
. It needs to be version 3.?.? not 2.2
Second issue:
After the version issue being resolved. Application ends with exception at following line
DotvvmAuthenticationHelper.ApplyRedirectResponse(context.HttpContext, context.ProtocolMessage.BuildRedirectUrl());
in Startup.cs
Solution:
I have added reference to Microsoft.AspNetCore.Authentication.AzureAD.UI
version 3.1.2
And replaced the services.AddAuthnetication(sharedOptions => ...
with following code
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
Also appsettings.json
needs to be in the following format
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "<domain>.onmicrosoft.com",
"TenantId": "....011db47...",
"ClientId": "....718bbc0a...",
"CallbackPath": "/signin-oidc"
}
Everything seems to be working fine except for this:
ClaimsPrincipal.Current
is null in ViewModels, but Context.HttpContext.User
contains correct identity.
The question is if ClaimsPrincipal.Current
not being populated represent issue for Dotvvm functionality.
Hi, Can you share your url reply in Azure AD, please? Thanks.
Andrey
How do I captured that reply? The auth is working now, as I posted.
When creating app from DotVVM wizard in VS2019 that is using Azure AD authentication. The app won't show any content when started. I think it's because .NET Core 3.1 changed the way the authentication is handled.
This is how
ConfigureServices
method looks in .net core 3.1 ASP MVC projectDotVVM: 2.2.155.0 VS 2019 .NET Core: 3.1