SecuringAspNetCore6WithOAuth2AndOIDC icon indicating copy to clipboard operation
SecuringAspNetCore6WithOAuth2AndOIDC copied to clipboard

Missing IdentityServerLicense class

Open wsigel opened this issue 1 year ago • 1 comments

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:

  1. deleting the folder Pages => Account =>Create
  2. by commenting out the Index constructor and the property mentioned above
  3. by commenting out the references to the Model.License in the Index.cshtml in the Pages folder

wsigel avatar Feb 21 '24 19:02 wsigel

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.

wsigel avatar Feb 22 '24 06:02 wsigel