Skip to content
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

Use SymmetricSecurityKey in Boilerplate jwt tokens (#10259) #10260

Merged
merged 4 commits into from
Mar 15, 2025

Conversation

ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Mar 15, 2025

closes #10259

Summary by CodeRabbit

  • New Features
    • The diagnostic modal now displays “Clear cache” for a more intuitive user action.
    • Authentication security has been enhanced to provide a more robust sign-in experience.
    • Android devices now require a minimum WebView version of 85 for improved performance and compatibility.

@ysmoradi ysmoradi requested a review from msynk March 15, 2025 15:12
Copy link

coderabbitai bot commented Mar 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request removes certificate file handling from several CI/CD workflows and project configurations while updating the security model. Certificate deletion, extraction, and related tasks have been eliminated and replaced by a symmetric JWT signing approach using a new secret. Additionally, method names and UI labels have been updated (e.g., "ClearData" → "ClearCache"), WebView minimum supported versions have been incremented, and various package as well as project references for certificates and Swagger have been removed.

Changes

File(s) Change Summary
.github/workflows/admin-sample.cd.yml, .github/workflows/sales-module-demo.cd.yml, .github/workflows/todo-sample.cd.yml, …/Bit.Boilerplate/.azure-devops/workflows/cd.yml, …/Bit.Boilerplate/.github/workflows/cd.yml Removed steps for deleting and extracting DataProtectionCertificate.pfx and updated environment/variable declarations (e.g., replacing DataProtectionCertificatePassword with Identity.JwtIssuerSigningKeySecret and adjusting connection string keys).
…/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppDiagnosticModal.razor
…/AppDiagnosticModal.razor.Utils.cs
Updated button functionality by renaming the event and method from "ClearData" to "ClearCache" and updating the button label accordingly.
…/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/App.xaml.cs
…/Templates01OverviewPage.razor
Incremented the minimum supported WebView version (84 → 85) and updated textual references within platform requirements.
…/Bit.Boilerplate/src/Directory.Packages.props
…/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj
…/AppDbContext.cs
…/launchSettings.json (server & web)
src/Websites/Careers/…/Bit.Websites.Careers.Server.csproj
src/Websites/Platform/…/Bit.Websites.Platform.Server.csproj
src/Websites/Sales/…/Bit.Websites.Sales.Server.csproj
…/ServerWebSettings.cs
Removed references to data protection certificate packages, eliminated certificate handling and file management (including IdentityCertificate.pfx), updated project port configurations, and adjusted conditional compilation comments.
…/Boilerplate.Server.Api/Program.Services.cs
…/ServerApiSettings.cs
…/AppJwtSecureDataFormat.cs
…/SimpleJwtSecureDataFormat.cs
…/appsettings.json (server & web)
Replaced certificate-based security with symmetric JWT signing. Updated code to generate a SymmetricSecurityKey from JwtIssuerSigningKeySecret, revised signing algorithm (from RSA-Sha512 to HMAC-Sha512), and enhanced related configuration and validation logic.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AuthService as Identity Service
    participant Config as App Settings
    participant JWT as JWT Handler

    Client->>AuthService: Send authentication request
    AuthService->>Config: Retrieve JwtIssuerSigningKeySecret
    Config-->>AuthService: Return JWT signing secret
    AuthService->>JWT: Generate symmetric key (HMAC-SHA512)
    JWT-->>AuthService: Token signed with symmetric key
    AuthService-->>Client: Return signed token
Loading
sequenceDiagram
    participant User
    participant UI as AppDiagnosticModal
    participant Cache as ClearCache Method

    User->>UI: Click "Clear cache" button
    UI->>Cache: Trigger ClearCache event
    Cache-->>UI: Sign out user, clear storage & cookies, refresh state
    UI-->>User: UI updated (cache cleared)
Loading

Poem

I'm a little rabbit with a code-filled cheer,
Hopping over changes that now appear.
Certificates have scampered out of sight,
JWT secrets now keep our tokens tight.
ClearCache is the new beat in our UI line,
Leaping through updates—simply divine!
🐇💻 Hop on, my friends, the code is just fine!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cff26d6 and 509b360.

📒 Files selected for processing (25)
  • .github/workflows/admin-sample.cd.yml (0 hunks)
  • .github/workflows/sales-module-demo.cd.yml (0 hunks)
  • .github/workflows/todo-sample.cd.yml (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppDiagnosticModal.razor (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppDiagnosticModal.razor.Utils.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/App.xaml.cs (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Data/AppDbContext.cs (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Properties/launchSettings.json (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/ServerApiSettings.cs (3 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Services/Identity/AppJwtSecureDataFormat.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Properties/launchSettings.json (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/ServerWebSettings.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Services/SimpleJwtSecureDataFormat.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json (1 hunks)
  • src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj (0 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/Templates/Templates01OverviewPage.razor (1 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj (0 hunks)
  • src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj (0 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@msynk msynk marked this pull request as ready for review March 15, 2025 16:56
@msynk msynk merged commit 809aed0 into bitfoundation:develop Mar 15, 2025
2 of 3 checks passed
@ysmoradi ysmoradi deleted the 10259 branch March 16, 2025 05:48
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.

Boilerplate project template must use SymmetricSecurityKey instead of pfx file for jwt tokens
2 participants