Skip to content

Conversation

@ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Jun 30, 2025

closes #11031

Summary by CodeRabbit

  • New Features

    • Social login buttons are now displayed dynamically based on the list of supported providers retrieved from the server, improving flexibility and accuracy.
    • A loading shimmer effect is shown while fetching available social login providers.
    • Apple and AzureAD social login options are now conditionally available.
  • Improvements

    • Enhanced separation of component logic and styles by recommending use of code-behind and dedicated style files in documentation.
    • PostgreSQL integration now supports dynamic JSON, improving database capabilities.

@ysmoradi ysmoradi requested review from Copilot and msynk June 30, 2025 12:17
@coderabbitai
Copy link

coderabbitai bot commented Jun 30, 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

The changes introduce dynamic retrieval and rendering of supported social sign-in providers in the Bit Boilerplate project. The client now queries the server for available providers, displays a loading shimmer while fetching, and conditionally renders only the supported social login buttons. Server-side, an endpoint is added to supply the current list of supported authentication schemes.

Changes

File(s) Change Summary
src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md Added best practice guidelines to use .razor.cs files for logic and .razor.scss files for styles, promoting separation of concerns.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor Changed markup to show a loading shimmer while fetching providers and conditionally render only supported social login buttons based on a dynamic list.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs Added async initialization to fetch supported providers, managed loading state, and refactored click handlers for providers. Injected identity controller dependency.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs Added dependency injection for authentication scheme provider and a new endpoint to return supported social authentication schemes.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs Updated PostgreSQL configuration to use NpgsqlDataSourceBuilder and enable dynamic JSON support before building the data source.
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Identity/IIdentityController.cs Added new method declaration to retrieve supported social authentication schemes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SocialRow (Client)
    participant IIdentityController (Client)
    participant IdentityController (Server)
    participant AuthSchemeProvider (Server)

    User->>SocialRow (Client): Visit social sign-in page
    SocialRow (Client)->>IIdentityController (Client): GetSupportedSocialAuthSchemes()
    IIdentityController (Client)->>IdentityController (Server): HTTP GET /GetSupportedSocialAuthSchemes
    IdentityController (Server)->>AuthSchemeProvider (Server): GetAllSchemes()
    AuthSchemeProvider (Server)-->>IdentityController (Server): List of schemes
    IdentityController (Server)-->>IIdentityController (Client): Supported provider names
    IIdentityController (Client)-->>SocialRow (Client): Supported provider names
    SocialRow (Client)->>User: Render only supported social login buttons
Loading

Assessment against linked issues

Objective Addressed Explanation
Dynamic list of social sign-in providers in bit Boilerplate (#11031)

Assessment against linked issues: Out-of-scope changes

Code Change (file_path) Explanation
Added PostgreSQL dynamic JSON support configuration (src/Server/Boilerplate.Server.Api/Program.Services.cs) This change relates to database configuration and is not mentioned in the objectives for dynamic social sign-in providers.

Poem

A rabbit hopped through code so bright,
Fetching providers, left and right—
No more buttons shown in vain,
Only those supported remain!
With shimmer loading, sleek and new,
The login page feels fresh and true.
🐇✨

✨ 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 implements dynamic social sign-in providers by exposing a new API endpoint and updating both server and client code to support dynamic provider displays.

  • Added a new GET endpoint in IIdentityController for retrieving supported social authentication schemes.
  • Updated the PostgreSQL configuration to use NpgsqlDataSourceBuilder with dynamic JSON support.
  • Refactored the SocialRow component to display social login buttons dynamically based on the providers returned by the API.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Identity/IIdentityController.cs Added the GET endpoint for fetching supported social auth schemes.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs Updated PostgreSQL configuration to leverage NpgsqlDataSourceBuilder and enable dynamic JSON support.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs Integrated the new endpoint by injecting IAuthenticationSchemeProvider and filtering the authentication schemes.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs Modified the SocialRow component logic to load and display dynamic social sign-in providers.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor Updated the UI to conditionally render social sign-in buttons based on supported providers.
src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md Added new guidelines for razor.cs code-behind and razor.scss files.
Comments suppressed due to low confidence (3)

src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Identity/IIdentityController.cs:62

  • Consider adding XML documentation for the GetSupportedSocialAuthSchemes endpoint to clarify its behavior and expected return values.
    Task<string[]> GetSupportedSocialAuthSchemes(CancellationToken cancellationToken);

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs:247

  • Add a comment to explain the use of EnableDynamicJson() and its impact on handling JSON data, to aid future maintainers.
            var dataSourceBuilder = new Npgsql.NpgsqlDataSourceBuilder(configuration.GetConnectionString("PostgreSQLConnectionString"));

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs:116

  • [nitpick] Include a brief comment explaining the rationale for filtering based on DisplayName and excluding IdentityConstants.ExternalScheme to improve code clarity.
            .Where(s => string.IsNullOrEmpty(s.DisplayName) is false && s.Name != IdentityConstants.ExternalScheme)

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: 2

🧹 Nitpick comments (1)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor (1)

10-14: Consider using a constant for the shimmer count.

The hardcoded loop count of 4 could be extracted to a constant for better maintainability, especially if the number of potential providers changes in the future.

+@{
+    const int MaxShimmerCount = 4;
+}

-@for (int i = 0; i < 4; i++)
+@for (int i = 0; i < MaxShimmerCount; i++)
📜 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 ec6d3fd and 20c0530.

📒 Files selected for processing (6)
  • src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor (1 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 (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Identity/IIdentityController.cs (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/Shared/Controllers/Identity/IIdentityController.cs (1)

61-62: LGTM!

The new method declaration follows established interface patterns with proper HTTP attribute decoration and consistent parameter usage.

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs (1)

247-249: LGTM!

The PostgreSQL configuration update correctly uses NpgsqlDataSourceBuilder to enable dynamic JSON support. This approach allows for proper data source-level feature configuration while maintaining the existing vector extension setup.

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs (2)

10-10: LGTM!

The dependency injection follows the established AutoInject pattern used throughout the controller.


110-121: LGTM!

The implementation correctly filters authentication schemes to return only those suitable for client-side social login:

  • Excludes schemes without display names (internal schemes)
  • Excludes the ExternalScheme used for internal auth flow
  • Returns clean array of provider names for client consumption
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor (2)

8-16: LGTM!

The loading shimmer provides good UX feedback while fetching supported providers. The consistent layout with 4 circular placeholders matches the potential number of social buttons.


19-59: LGTM!

The conditional rendering logic correctly displays only supported social authentication providers. Each provider is properly wrapped in a supportedProviders.Contains() check, ensuring dynamic behavior based on server configuration.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/Components/SocialRow.razor.cs (2)

1-14: LGTM! Clean setup and proper dependency injection.

The field initialization, parameter declaration, and dependency injection follow Blazor best practices correctly.


30-35: LGTM! Clean refactoring to expression-bodied methods.

The refactoring to expression-bodied async methods improves code readability and maintains consistency across all handler methods.

@ysmoradi ysmoradi merged commit d245ad0 into bitfoundation:develop Jun 30, 2025
3 checks passed
@ysmoradi ysmoradi deleted the 11031 branch June 30, 2025 15:54
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.

Dynamic list of social sign-in providers in bit Boilerplate

1 participant