SecuringAspNetCore6WithOAuth2AndOIDC
SecuringAspNetCore6WithOAuth2AndOIDC copied to clipboard
Missing IdentityServerLicense class
Following the approach in module 3 after creating the ui with "dotnet new isui" the generated Pages-Folder contains an Index.cshtml.cs file with the following content:
`using Duende.IdentityServer; using System.Reflection; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Marvin.IDP.Pages.Home;
[AllowAnonymous] public class Index : PageModel { public Index(IdentityServerLicense? license = null) { License = license; }
public string Version
{
get => typeof(Duende.IdentityServer.Hosting.IdentityServerMiddleware).Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion.Split('+').First()
?? "unavailable";
}
public IdentityServerLicense? License { get; }
}`
However the class 'IdentityServerLicense' is nowhere to be found so the project Marvin.IDP doesn't compile.
Also the mentioned dotnet command created a Pages => Account =>Create Folder in which another Index.cshtml.cs file mentioned a missing:
var user = _users.CreateUser(Input.Username, Input.Password, Input.Name, Input.Email);
I only got the example running by:
- deleting the folder Pages => Account =>Create
- by commenting out the Index constructor and the property mentioned above
- by commenting out the references to the Model.License in the Index.cshtml in the Pages folder
Finally figured out what was missing when the "Duende.IdentityServer.Templates" was installed when using the commandline: The appropriate version must be included like:
dotnet new install Duende.IdentityServer.Templates::6.1.1
Then everything works out like demonstrated in the video.