question

alexandreamiel-5984 avatar image
0 Votes"
alexandreamiel-5984 asked ZhiLv-MSFT answered

Why so many template parts seems to be not accesible with .NET Core and Angular Individual Account Authentication Template

I'm a .NET Core Developer which has for a new project the necessity to implement .NET Core Authentication using Individual Account.
The template using .NET and Angular with Individual Account and Authentication works, but so many parts of the template are unreachable for my actual understanding of the .NET framework. There are many features implemented in this project template ( Confirming User Mail, Enabling User 2 Factors Authentication, Adding Third Party Providers like Google or Facebook ) which are great, butthese parts are not accessible in the angular templates, even not in the razor pages, so it's complicated for me to use these features . or i can these template parts missing from source code ? Like User Confirmed template, i dont know where to find this template.
Question : Where is the template for : Identity/Account/RegisterConfirmation ?
Thanks for your support !

dotnet-csharpdotnet-aspnet-core-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZhiLv-MSFT avatar image
1 Vote"
ZhiLv-MSFT answered

Hi @alexandreamiel-5984,

By default, when we use the .NET Core and Angular Individual Account Authentication Template create an application, it will use the Asp.net core Identity provides the user interface (UI) login functionality and manager users and roles. And by default, these pages are in the Identity Razor Class Library (RCL). To see these page or modify the code and change the behavior, you can refer the following steps:

  1. Using Visual Studio 2019, create a new Asp.net 5 project with the Asp.net Core and Angular template, and select the Individual Account Authentication type.

  2. Open the Nuget and update the relate package to the latest version.

    145704-image.png

  3. Right click the Project, click Add => New Scaffolded Item => Identity => Identity => click Add button, then you can select the Identity page and set the Data Context Class

    145679-image.png

    After click "Add" button, you can see these Identity page from the Areas/Identity/Pages folders, then you can modify the Identity page content:

    145640-image.png

More detail information about custom Identity, you can see Scaffold Identity in ASP.NET Core projects and Identity model customization in ASP.NET Core.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Best regards,
Dillion


image.png (100.4 KiB)
image.png (44.2 KiB)
image.png (36.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

alexandreamiel-5984 avatar image
0 Votes"
alexandreamiel-5984 answered alexandreamiel-5984 edited

I'm installing RazorRuntimeCompilation package, hope it will helps to go deeper in the source code ! ( following instructions here : https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-5.0&tabs=visual-studio )

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

The angular and react templates are SPA applications. These should use oauth for authentication, and this is what the templates do. The oauth server handles all registration, and account management, not your application. See

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-5.0

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

alexandreamiel-5984 avatar image
0 Votes"
alexandreamiel-5984 answered Bruce-SqlWork commented

Yes, but there are also additional Templates I cannot find out how to access the code source, lets say if i want to modify the design of Third Party login Buttons ?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What templates are you referring to? Templates you found on the internet?

0 Votes 0 ·

I'm using .NET Core and Angular Individual Account Authentication Project Template ( I'm talking about Project Template AND Front Template parts ) : If, for instance, you search in the entire solution the text pattern "Use another service" you won't find it, but this title is displayed when I navigate to Identity/Account/Login Angular route. So it is injected somewhere from the code, but i don't know where exactly. In any cases, I managed on my own settling a project using Authentication with Angular, but for my personal experience, because some templates parts seems to be hidden from the code source ( some parts are not in Angular source code, Razor Pages nor in .NET source code ), so this project template wasn't fitting my learning because of these templates parts missing in the project template source code.

0 Votes 0 ·

The individual accounts template uses the nuget identity library, which uses razor pages for the login form. There is no source in the template, just a library reference. See

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-5.0&tabs=visual-studio

You can find the source in the aspnet core project

https://github.com/dotnet/aspnetcore/tree/8b30d862de6c9146f466061d51aa3f1414ee2337/src/Identity/UI/src

1 Vote 1 ·