-
-
Notifications
You must be signed in to change notification settings - Fork 254
Add test identity server to make social sign-in testing eaiser in Boilerplate (#11022) #11023
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
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA new "IdentityServerDemo" social sign-in option has been integrated into the Bit Boilerplate project. This includes UI components for the demo provider, updates to localization resources, conditional rendering for development environments, backend support for the new authentication scheme, and minor enhancements to claim extraction logic during social sign-in. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ClientApp
participant IdentityServerDemo
participant ServerApi
User->>ClientApp: Clicks "Sign in with Test server" (dev only)
ClientApp->>ServerApi: Initiate OIDC flow (Identity-Server-Demo)
ServerApi->>IdentityServerDemo: Redirect for authentication
IdentityServerDemo->>User: Prompt for login
User->>IdentityServerDemo: Submits credentials
IdentityServerDemo->>ServerApi: Redirect with auth code
ServerApi->>IdentityServerDemo: Exchange code for tokens
ServerApi->>IdentityServerDemo: Retrieve user info
ServerApi->>ClientApp: Complete sign-in, return user session
Assessment against linked issues
Poem
✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Pull Request Overview
This PR adds support for a public Duende IdentityServer demo to simplify social sign-in testing in the boilerplate, including UI updates and new localization strings.
- Introduces a new OpenID Connect scheme targeting the Duende demo server.
- Adds "IdentityServerDemo" and "AzureEntra" sign-in strings and icons.
- Updates the social sign-in component to invoke the demo server in development.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/Resources/AppStrings.resx | Added localization keys for IdentityServerDemo and Azure Entra sign-in buttons |
| src/Shared/Resources/AppStrings.fa.resx | Added Farsi translations for the new sign-in keys |
| src/Server/Boilerplate.Server.Api/Program.Services.cs | Registered a new OIDC scheme for the Duende demo server |
| src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs | Added fallback claim lookup for "name" in social callback |
| src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs | Added handler for the demo server button click |
| src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor | Render demo server button in dev only |
| src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/IdentityServerDemoIcon.razor | New SVG icon for the demo server |
| src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/AzureEntraIcon.razor | New SVG icon for Azure Entra sign-in |
Comments suppressed due to low confidence (2)
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs:52
- [nitpick] It would be helpful to add a brief comment explaining why the "name" claim is retrieved last, to clarify intent for future maintainers.
var name = info.Principal.FindFirstValue("preferred_username") ?? info.Principal.FindFirstValue(ClaimTypes.Name) ?? info.Principal.FindFirstValue(ClaimTypes.NameIdentifier) ?? info.Principal.FindFirstValue("name");
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor:6
- The new Development-only demo sign-in button is untested; consider adding UI tests or component tests to cover this branch.
@if (AppEnvironment.IsDev())
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs
Outdated
Show resolved
Hide resolved
...e/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting
📒 Files selected for processing (8)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/AzureEntraIcon.razor(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/IdentityServerDemoIcon.razor(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor(2 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.fa.resx(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.resx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build and test
🔇 Additional comments (8)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/IdentityServerDemoIcon.razor (1)
1-11: LGTM! Well-structured static icon component.The SVG icon follows good practices by using CSS custom properties for theming and proper viewBox dimensions. The component correctly inherits from StaticComponent for optimal performance.
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.resx (1)
629-635: LGTM! Proper localization resource additions.The new resource entries follow the established naming conventions and are properly formatted. The button text is clear and appropriate for the social sign-in functionality.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs (1)
34-37: LGTM! Consistent implementation pattern.The new handler method follows the exact same pattern as existing social sign-in handlers, maintaining consistency across the codebase.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs (1)
52-52: LGTM! Enhanced claim extraction compatibility.Adding "name" as an additional fallback claim type improves compatibility with different OIDC providers while maintaining the existing fallback pattern.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor (2)
6-11: LGTM! Proper development-only conditional rendering.The conditional rendering using
AppEnvironment.IsDev()is the correct approach for a test identity server that should only appear in development environments.
25-33: Verify that commenting out Apple and Azure AD buttons is intentional.The Apple and Azure AD social sign-in buttons have been commented out. Please confirm this is intentional and not a temporary change that should be reverted.
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.fa.resx (1)
627-632: LGTM! Persian translations are accurate.The Persian translations for the new social sign-in buttons are correct and follow the established naming pattern.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/AzureEntraIcon.razor (1)
1-8: Clean SVG icon component implementation.The component correctly inherits from
StaticComponentand uses CSS custom properties for theming. The SVG structure follows web standards and is appropriately sized.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs
Outdated
Show resolved
Hide resolved
…te.Server.Api/Program.Services.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Yaser Moradi <ysmoradi@outlook.com>
closes #11022
Summary by CodeRabbit
New Features
Bug Fixes
Chores