-
-
Notifications
You must be signed in to change notification settings - Fork 363
doc(MFA): add enable 2FA sample code #5994
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
Conversation
Reviewer's GuideThis pull request implements a new sample page for enabling Two-Factor Authentication (2FA) using an authenticator app. This involves generating a QR code for app setup and verifying the entered code. Existing MFA tutorial pages were updated to include a link to this new registration flow, and a minor layout adjustment was made to the login sample page. Sequence Diagram for 2FA Registration ProcesssequenceDiagram
title Sequence Diagram for 2FA Registration Process
actor User
participant RegisterPage as "Register.razor"
participant TotpSvc as "ITotpService"
participant NavMgr as "NavigationManager"
Note over RegisterPage: Page Initialization (OnInitialized)
RegisterPage->>TotpSvc: GenerateOtpUri(OtpOptions)
activate TotpSvc
TotpSvc-->>RegisterPage: otpUri (for QR Code)
deactivate TotpSvc
RegisterPage-->>User: Displays QR Code and input field
User->>RegisterPage: Enters verification code
User->>RegisterPage: Clicks "Save" button (triggers OnRegister)
activate RegisterPage
RegisterPage->>TotpSvc: Compute(secretKey) // To get expected code
activate TotpSvc
TotpSvc-->>RegisterPage: expectedOtpCode
deactivate TotpSvc
alt User's entered code matches expectedOtpCode
RegisterPage->>NavMgr: NavigateTo("/tutorials/mfa/two-factor/app")
else User's entered code is invalid
Note over RegisterPage: User remains on page, can retry
end
deactivate RegisterPage
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- The layout adjustment in
Login.razorappears to be a separate concern from adding the 2FA sample code; consider addressing it in a dedicated PR.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/BootstrapBlazor.Server/Components/Samples/Tutorials/MFA/Register.razor
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5994 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 670 670
Lines 30616 30616
Branches 4353 4353
=========================================
Hits 30616 30616 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: ChenHan819 <[email protected]>
# Conflicts: # src/BootstrapBlazor/BootstrapBlazor.csproj
Link issues
fixes #5993
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add a new page for enabling two-factor authentication (2FA) with QR code registration in the BootstrapBlazor tutorial section
New Features:
Enhancements:
Documentation: