Skip to content

Add more MapIdentityApi endpoints #49498

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

Merged
merged 10 commits into from
Jul 27, 2023
Merged

Add more MapIdentityApi endpoints #49498

merged 10 commits into from
Jul 27, 2023

Conversation

halter73
Copy link
Member

@halter73 halter73 commented Jul 18, 2023

This adds the following new endpoints:

  • GET /confirmEmail
  • POST /resendConfirmationEmail
  • POST /resetPassword
  • GET /account/2fa
  • POST /account/2fa
  • GET /account/info
  • POST /account/info

Additionally, the existing /login endpoint now accepts 2fa codes and 2fa recovery codes as part of the request body. These can be queried and regenerated from /account/2fa. The /login endpoint now also gives limited failure reasons in the form of application/problem+json instead of empty 401 responses with details such as "LockedOut", "RequiresTwoFactor", "NotAllowed" (usually because lack of email confirmation), and the generic "Failed" statuses.

Fixes #47232 (lockout support)
Fixes #47231 (reset password support)
Fixes #47230 (2fa support)
Fixes #47229 (change username and password)
Fixes #49404 (removes AddIdentityBearerToken which is no longer needed)

@ghost ghost added the area-identity Includes: Identity and providers label Jul 18, 2023
@AlexKovynev
Copy link

maybe #47232 not #47432 :)

@halter73 halter73 requested review from davidfowl and Tratcher July 21, 2023 00:30
@halter73 halter73 marked this pull request as ready for review July 21, 2023 00:30
@halter73 halter73 requested a review from javiercn as a code owner July 21, 2023 00:30
@halter73
Copy link
Member Author

/backport to release/8.0-preview7

@github-actions
Copy link
Contributor

Started backporting to release/8.0-preview7: https://github.com/dotnet/aspnetcore/actions/runs/5617585393

mkArtakMSFT pushed a commit that referenced this pull request Jul 21, 2023
Backport of #49498 to release/8.0-preview7

/cc @halter73

# Add more MapIdentityApi endpoints
## Description

This adds the following new endpoints:

- GET /confirmEmail
- POST /resendConfirmationEmail
- POST /resetPassword
- GET /account/2fa
- POST /account/2fa
- GET /account/info
- POST /account/info

Additionally, the existing /login endpoint now accepts 2fa codes and 2fa recovery codes as part of the request body. These can be queried and regenerated from /account/2fa. The /login endpoint now also gives limited failure reasons in the form of application/problem+json instead of empty 401 responses with details such as "LockedOut", "RequiresTwoFactor", "NotAllowed" (usually because lack of email confirmation), and the generic "Failed" statuses.

Fixes #47232 (lockout support)
Fixes #47231 (reset password support)
Fixes #47230 (2fa support)
Fixes #47229 (change username and password)
Fixes #49404 (Removes AddIdentityBearerToken which is no longer needed)

## Customer Impact

This makes the MapIdentityApi API introduced in preview4 more usable. See https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-4/#auth where we promised the following.

> In addition to user registration and login, the identity API endpoints will support features like two-factor authentication and email verification in upcoming previews. You can find a list of planned features in the issues labeled [feature-token-identity](https://github.com/dotnet/aspnetcore/issues?q=is%3Aopen+label%3Afeature-token-identity+sort%3Aupdated-desc) on the ASP.NET Core GitHub repository.

This PR adds all of these features, and it's important to make this available to customers as soon as possible, so we have time to react to any feedback. It appears customers are [excited to give it a go.](https://www.reddit.com/r/programming/comments/13jxcsx/aspnet_core_updates_in_net_8_preview_4_net_blog/jki0p3g/)

## Regression?

- [ ] Yes
- [x] No

## Risk

- [ ] High
- [ ] Medium
- [x] Low

This is primarily new API with minimal changes to SignInManager that should have no impact unless used by the new MapIdentityApi endpoints.

## Verification

- [x] Manual (required)
- [x] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A
- Use ToDictionary when it's straightforward
- Clear ProviderInstance when adding provider type to existing TokenProviderDescriptor
- Apply API review feedback
@halter73
Copy link
Member Author

@BrennanConroy I responded to all of your feedback. Does this look good to merge?

@javiercn Let me know if you have any additional feedback. I'd like to merge this by tomorrow.

@halter73 halter73 enabled auto-merge (squash) July 27, 2023 18:58
@halter73 halter73 merged commit adbd741 into main Jul 27, 2023
@halter73 halter73 deleted the halter73/more-identity-apis branch July 27, 2023 20:15
@ghost ghost added this to the 8.0-rc1 milestone Jul 27, 2023
@augustevn
Copy link

@ghost
Copy link

ghost commented Sep 22, 2023

Hi @augustevn. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-identity Includes: Identity and providers
Projects
None yet
5 participants