-
-
Notifications
You must be signed in to change notification settings - Fork 254
Dynamic social sign-in providers in bit Boilerplate (#11031) #11032
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 WalkthroughThe 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
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
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
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 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)
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: 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
📒 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
NpgsqlDataSourceBuilderto 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
AutoInjectpattern 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
ExternalSchemeused 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.
closes #11031
Summary by CodeRabbit
New Features
Improvements