Skip to content

Conversation

@ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Jun 27, 2025

closes #11022

Summary by CodeRabbit

  • New Features

    • Added a new social login option for "IdentityServerDemo" available in development mode, including a dedicated icon.
    • Introduced localized button text for "Sign in with Test server" and "Sign in with Azure Entra" in English and Persian.
  • Bug Fixes

    • Improved handling of user name extraction during social sign-in by supporting additional claim types.
  • Chores

    • Added static icons for Azure Entra and IdentityServerDemo sign-in options.

@ysmoradi ysmoradi requested review from Copilot and msynk June 27, 2025 07:04
@coderabbitai
Copy link

coderabbitai bot commented Jun 27, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A 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

File(s) Change Summary
.../Components/Pages/Identity/Components/AzureEntraIcon.razor Added static Razor component for Azure Entra SVG icon.
.../Components/Pages/Identity/Components/IdentityServerDemoIcon.razor Added static Razor component for IdentityServerDemo SVG icon.
.../Components/Pages/Identity/Components/SocialRow.razor Added conditional rendering for IdentityServerDemo button in development; commented out Apple/Azure AD.
.../Components/Pages/Identity/Components/SocialRow.razor.cs Added async handler for IdentityServerDemo button click event.
.../Controllers/Identity/IdentityController.SocialSignIn.cs Enhanced claim extraction to include "name" as a fallback.
.../Server/Boilerplate.Server.Api/Program.Services.cs Added "Identity-Server-Demo" OpenID Connect authentication scheme using Duende public demo server.
.../Shared/Resources/AppStrings.fa.resx
.../Shared/Resources/AppStrings.resx
Added localized resource strings for IdentityServerDemo and Azure Entra sign-in button text.

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
Loading

Assessment against linked issues

Objective Addressed Explanation
Add a test identity server to facilitate testing social sign-in (#11022)
Add UI for selecting the test identity server in development (#11022)
Add backend support for the test identity server authentication scheme (#11022)
Localize new sign-in button text for the test identity server (#11022)

Poem

A demo sign-in hops to the scene,
For testing made easy, quick, and clean.
Buttons and icons, new and bright,
Guide devs through the login night.
With claims in tow and tokens in hand,
The boilerplate’s ready—just as planned!
🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Copilot AI left a 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())

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3392e25 and 7db9b8e.

📒 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 StaticComponent and uses CSS custom properties for theming. The SVG structure follows web standards and is appropriately sized.

ysmoradi and others added 2 commits June 27, 2025 09:08
…te.Server.Api/Program.Services.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Yaser Moradi <ysmoradi@outlook.com>
@ysmoradi ysmoradi changed the title add test identity server to make social sign-in testing eaiser in Boilerplate (#11022) Add test identity server to make social sign-in testing eaiser in Boilerplate (#11022) Jun 27, 2025
@ysmoradi ysmoradi merged commit 321d860 into bitfoundation:develop Jun 27, 2025
3 checks passed
@ysmoradi ysmoradi deleted the 11022 branch June 27, 2025 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test identity server is required to make testing social sign-in in bit Boilerplate eaiser

1 participant