dotnet / dotnet/aspnetcore

Customizability Identity Endpoints

Open
#54,073 2 comments 12 reactions 0 assignees View on GitHub
api-suggestion area-identity enhancement feature-identity-apis
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

The Identity Endpoints are currently lacking customizability due to using DTO's we can't pass extra properties.
This may be intentional and we can certainly work around that but...

I wonder if something like this is feasable:

```csharp
app.MapIdentityEndpoints()
.AddLoginEndpoint("/login") // optionally overwriting the route.
.AddRegisterEndpoint() // this will end up in the IEmailSender implementation.
...
```

* Accessing `TRequest` in the `IEmailSender` implementation might solve my previous request for `RedirectUrl`.
* With some mapping inside to map to `TUser` and some contraints / validation on the minimum required props per request. This way, our own validators can also be applied.

And leave an option for adding all endpoints at once:

```csharp
app.MapIdentityEndpointDefaults();
```

It would also be cool to be able to access re-usable methods to implement in our own API endpoints or in Blazor Server directly.
Currently it's suggested to overwrite or extend that entire class holding the endpoints with all the logic inside the endpoints.

Just an idea, let me know what you think!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.