Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split MapIdentityApi<TUser>() into multiple APIs and allow selective end points to be enabled #55792

Open
VasuInukollu opened this issue May 19, 2024 · 1 comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-identity Includes: Identity and providers enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-identity-apis
Milestone

Comments

@VasuInukollu
Copy link

Background and Motivation

The Identity API endpoints are a much need addition to Identity framework. The current API endpoint route implementation (IdentityApiEndpointRouteBuilderExtensions.cs) has a single API to add all/multiple endpoints to the pipeline.

It would great to have control on which endpoints will be available if we don't want to have some functionality in the application.

A way to allow individual API endpoints to be added will help in plenty of scenarios.

Proposed API

namespace Microsoft.AspNetCore.Routing;

public static class IdentityApiEndpointRouteBuilderExtensions
{

    public static IEndpointConventionBuilder MapIdentityApi<TUser>(this IEndpointRouteBuilder endpoints)

+    public static IEndpointConventionBuilder MapIdentityRegisterApi<TUser>(this IEndpointRouteBuilder endpoints)
+    public static IEndpointConventionBuilder MapIdentityLoginApi<TUser>(this IEndpointRouteBuilder endpoints)
+    public static IEndpointConventionBuilder MapIdentityRefreshApi<TUser>(this IEndpointRouteBuilder endpoints)

}

Usage Examples

We can add the required mapping for each endpoint.

app.MapIdentityLoginApi<IdentityUser>();
app.MapIdentityRefreshApi<IdentityUser>();

Alternative Designs

We have the option of adding the full code from this URL into the project and remove the unwanted parts. But that's not a great experience.

https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs

Risks

Nothing that I can think of.

@VasuInukollu VasuInukollu added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label May 19, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-identity Includes: Identity and providers label May 19, 2024
@MackinnonBuck
Copy link
Member

Seems related to #55529

@MackinnonBuck MackinnonBuck added this to the Backlog milestone May 22, 2024
@MackinnonBuck MackinnonBuck added feature-identity-apis enhancement This issue represents an ask for new feature or an enhancement to an existing one labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-identity Includes: Identity and providers enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-identity-apis
Projects
None yet
Development

No branches or pull requests

2 participants