I have an ASP.NET 8 Web API and I'm trying to edit the default Identity endpoints. I.e. handling the extended user class on register and login. I wrote my own endpoint for registering, and it functions, though I don't want to write my own one for logging in as it would be considerably more complex. I need a way of editing the InputModel
, as well as perhaps other parts of the methods called by the endpoint.
I tried Add -> New scaffolding item -> Identity -> Account\Login
and files relating to layout/ unnecessary files were generated
I have looked into scaffolding Identity (Account\login), but that adds files relating to the layout as cshtml files, where my solution is purely an API.
Is there a way to scaffold or edit Identity logic files without the layout (I'm assuming this is related to MVC), or are there any suggestions for alternatives on editing the InputModel
/ default endpoints.
Thanks
I was not able to come up with a way to override or customise the existing endpoints so I've had to write them myself.
Luckily, you can view the asp.net core identity source code and you can access the services such as the SignInManager<T>
by injecting them into your service/ controller. Using this information, you can write your own endpoints and modify the existing ones in which ever way you like with the assurance that you don't miss anything out.
This is the file I found to contain the source identity endpoints: https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs