Skip to content

Conversation

@gimlichael
Copy link
Member

@gimlichael gimlichael commented Apr 13, 2025

This pull request focuses on refactoring the DigestAuthentication feature in the Cuemon.AspNetCore.Authentication package. The main changes include replacing the UnkeyedCryptoAlgorithm with a new DigestCryptoAlgorithm, updating the relevant methods and properties accordingly, and marking some members as obsolete.

Refactoring Digest Authentication:

Updating Digest Authorization Header Builder:

Summary by CodeRabbit

  • New Features

    • Enhanced digest authentication by supporting a broader range of secure cryptographic algorithms, including SHA-512/256.
    • Introduced a refined configuration option for selecting the desired digest algorithm.
  • Refactor

    • Streamlined the authentication configuration to improve clarity and ensure future compatibility by transitioning to new algorithm types.
  • Tests

    • Expanded test coverage to verify robust handling of various digest algorithm options, including parameterized tests for different algorithms.

@gimlichael gimlichael requested a review from Copilot April 13, 2025 13:42
@gimlichael gimlichael self-assigned this Apr 13, 2025
@coderabbitai
Copy link

coderabbitai bot commented Apr 13, 2025

Walkthrough

The pull request updates the digest authentication implementation by replacing the legacy Algorithm property with a new DigestAlgorithm property across multiple components. The changes affect header construction, algorithm parsing, and hash computation. A new enumeration, DigestCryptoAlgorithm, and a corresponding factory (DigestHashFactory) have been added to facilitate clearer, type-safe algorithm handling. Test methods have been revised to use parameterized inputs for various digest algorithms. Overall, the modifications ensure consistency and improve the maintainability of the digest authentication flow.

Changes

File(s) Change Summary
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationHandler.cs
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationMiddleware.cs
Updated header generation and parsing logic to reference DigestAlgorithm instead of Algorithm. Parameter type in ParseAlgorithm changed from UnkeyedCryptoAlgorithm to DigestCryptoAlgorithm, with new cases for various digest algorithms.
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationOptions.cs
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs
Replaced the Algorithm property with a new DigestAlgorithm property. Constructors, method signatures, and internal logic (including hash computations) have been updated accordingly, deprecating legacy implementations.
src/Cuemon.AspNetCore.Authentication/Digest/DigestCryptoAlgorithm.cs Introduced a new enumeration DigestCryptoAlgorithm defining supported algorithms: Md5, Md5Session, Sha256, Sha256Session, Sha512Slash256, and Sha512Slash256Session.
src/Cuemon.AspNetCore.Authentication/Digest/DigestHashFactory.cs Added a new static factory class for creating hash instances based on DigestCryptoAlgorithm. The method robustly maps to the correct underlying implementation and handles unsupported algorithms with an exception.
Test Files:
test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs
test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationMiddlewareTest.cs
test/Cuemon.AspNetCore.Authentication.Tests/DigestAuthenticationOptionsTest.cs
test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs
Updated tests to employ the [Theory] attribute with [InlineData] for parameterized testing and switched references from Algorithm to DigestAlgorithm to validate correct behavior with all supported digest algorithms.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant H as DigestAuthHandler
    participant M as DigestAuthMiddleware
    participant O as AuthOptions
    participant B as AuthHeaderBuilder
    participant F as DigestHashFactory

    C->>H: Request resource
    H->>M: Initiate authentication challenge
    M->>O: Retrieve DigestAlgorithm configuration
    O-->>M: Return DigestAlgorithm (e.g., Sha256)
    M->>B: Build WWW-Authenticate header using DigestAlgorithm
    B->>F: Compute digest hash based on provided algorithm
    F-->>B: Return computed hash
    B-->>M: Deliver authentication header
    M-->>H: Forward header for challenge response
    H-->>C: Send challenge response
Loading

Poem

I'm a happy rabbit, hopping through the code,
Now with DigestAlgorithm lightening every load.
Old names have hopped away, giving way to the new,
Cryptographic carrots guide me in all I do.
With enums and factories, my code garden's bright—
Leaping through digest changes with pure delight!
🥕🐇Happy coding from the bunny in the byte!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between abfebdc and 6f1a90b.

📒 Files selected for processing (15)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationHandler.cs (1 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationMiddleware.cs (2 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationOptions.cs (4 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (8 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestCryptoAlgorithm.cs (1 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestHashFactory.cs (1 hunks)
  • src/Cuemon.Security.Cryptography/SHA512256.cs (1 hunks)
  • src/Cuemon.Security.Cryptography/SecureHashAlgorithm512256.cs (1 hunks)
  • src/Cuemon.Security.Cryptography/UnkeyedCryptoAlgorithm.cs (1 hunks)
  • src/Cuemon.Security.Cryptography/UnkeyedHashFactory.cs (1 hunks)
  • test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs (9 hunks)
  • test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationMiddlewareTest.cs (3 hunks)
  • test/Cuemon.AspNetCore.Authentication.Tests/DigestAuthenticationOptionsTest.cs (1 hunks)
  • test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs (4 hunks)
  • test/Cuemon.Security.Cryptography.Tests/UnkeyedHashFactoryTest.cs (1 hunks)

🪧 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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

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.

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

Comments suppressed due to low confidence (1)

src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs:76

  • [nitpick] The obsolete 'Algorithm' property coexists with the new 'DigestAlgorithm' property, which may lead to confusion. Consider removing or clearly documenting this obsolete property to clarify its role for backward compatibility.
public UnkeyedCryptoAlgorithm Algorithm { get; }

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

🧹 Nitpick comments (2)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (2)

293-294: Minor optimization suggestion: avoid recreating the hash instance.
You could store the Hash object in a local variable rather than calling DigestHashFactory.CreateCrypto(DigestAlgorithm) multiple times to marginally improve performance.

For example:

- var hashFields = ...
-     : string.Create(CultureInfo.InvariantCulture, $"{method}:{Data[DigestFields.DigestUri]}:{DigestHashFactory.CreateCrypto(DigestAlgorithm).ComputeHash(entityBody, ...).ToHexadecimalString()}");
- return DigestHashFactory.CreateCrypto(DigestAlgorithm).ComputeHash(hashFields, ...).ToHexadecimalString();

+ var factory = DigestHashFactory.CreateCrypto(DigestAlgorithm);
+ var computedEntity = factory.ComputeHash(entityBody, o => o.Encoding = Encoding.UTF8).ToHexadecimalString();
+ var hashFields = !hasIntegrityProtection
+     ? string.Create(CultureInfo.InvariantCulture, $"{method}:{Data[DigestFields.DigestUri]}")
+     : string.Create(CultureInfo.InvariantCulture, $"{method}:{Data[DigestFields.DigestUri]}:{computedEntity}");
+ return factory.ComputeHash(hashFields, o => o.Encoding = Encoding.UTF8).ToHexadecimalString();

311-311: Same optimization applies to ComputeResponse.
Reusing a single Hash instance avoids multiple factory lookups per call.

- return DigestHashFactory.CreateCrypto(DigestAlgorithm).ComputeHash(
+ var factory = DigestHashFactory.CreateCrypto(DigestAlgorithm);
+ return factory.ComputeHash(
    string.Create(...),
    o => ...
).ToHexadecimalString();
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between abfebdc and 1be7bdf.

📒 Files selected for processing (10)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationHandler.cs (1 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationMiddleware.cs (2 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationOptions.cs (4 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (8 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestCryptoAlgorithm.cs (1 hunks)
  • src/Cuemon.AspNetCore.Authentication/Digest/DigestHashFactory.cs (1 hunks)
  • test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs (9 hunks)
  • test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationMiddlewareTest.cs (3 hunks)
  • test/Cuemon.AspNetCore.Authentication.Tests/DigestAuthenticationOptionsTest.cs (1 hunks)
  • test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (8)
src/Cuemon.AspNetCore.Authentication/Digest/DigestCryptoAlgorithm.cs (1)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (1)
  • DigestCryptoAlgorithm (214-223)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationHandler.cs (2)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationMiddleware.cs (5)
  • DigestAuthorizationHeader (135-138)
  • DigestAuthenticationMiddleware (19-160)
  • DigestAuthenticationMiddleware (26-28)
  • DigestAuthenticationMiddleware (35-37)
  • ParseAlgorithm (140-159)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeader.cs (4)
  • DigestAuthorizationHeader (14-217)
  • DigestAuthorizationHeader (27-31)
  • DigestAuthorizationHeader (38-40)
  • DigestAuthorizationHeader (55-67)
test/Cuemon.AspNetCore.Authentication.Tests/DigestAuthenticationOptionsTest.cs (1)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (1)
  • DigestCryptoAlgorithm (214-223)
src/Cuemon.AspNetCore.Authentication/Digest/DigestHashFactory.cs (1)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (1)
  • DigestCryptoAlgorithm (214-223)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationOptions.cs (1)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (2)
  • DigestCryptoAlgorithm (214-223)
  • Obsolete (29-48)
test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs (1)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (1)
  • DigestCryptoAlgorithm (214-223)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (3)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationMiddleware.cs (1)
  • ParseAlgorithm (140-159)
src/Cuemon.AspNetCore.Authentication/AuthorizationHeaderBuilder.cs (1)
  • ValidateData (99-107)
src/Cuemon.AspNetCore.Authentication/Digest/DigestHashFactory.cs (1)
  • DigestHashFactory (10-34)
test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs (1)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (1)
  • DigestCryptoAlgorithm (214-223)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: 🐧 Prepare Linux
  • GitHub Check: 🪟 Prepare Windows
🔇 Additional comments (37)
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationHandler.cs (1)

69-69: Properly migrated to use DigestAlgorithm instead of Algorithm

The change correctly updates the WWWAuthenticate header construction to use the new Options.DigestAlgorithm instead of the deprecated Algorithm property. This aligns with the overall refactoring to use the more specific DigestCryptoAlgorithm type throughout the codebase.

src/Cuemon.AspNetCore.Authentication/Digest/DigestCryptoAlgorithm.cs (1)

6-37: Well-structured enumeration for digest algorithms

The newly added DigestCryptoAlgorithm enum is well-designed with:

  • Clear documentation for each algorithm variant
  • Appropriate naming that follows C# conventions
  • Support for both standard and session variants of each algorithm
  • Explicit integer values for each enum member

This provides a more type-safe approach compared to the previous implementation and clearly communicates the supported digest algorithms.

One observation: The enum values start from -2 rather than 0, which is slightly unusual but likely intentional for backward compatibility or other technical reasons.

test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationMiddlewareTest.cs (3)

120-120: Correctly updated to use DigestAlgorithm property

The test has been properly updated to use the new DigestAlgorithm property when instantiating the DigestAuthorizationHeaderBuilder, aligning with the changes in the main implementation.


196-196: Correctly updated to use DigestAlgorithm property

The test has been properly updated to use the new DigestAlgorithm property when instantiating the DigestAuthorizationHeaderBuilder, aligning with the changes in the main implementation.


271-271: Correctly updated to use DigestAlgorithm property

The test has been properly updated to use the new DigestAlgorithm property when instantiating the DigestAuthorizationHeaderBuilder, aligning with the changes in the main implementation.

test/Cuemon.AspNetCore.Authentication.Tests/DigestAuthenticationOptionsTest.cs (1)

182-182: Correctly updated default value assertion

The test has been properly updated to assert the default value of the new DigestAlgorithm property is DigestCryptoAlgorithm.Sha256, replacing the previous assertion that checked the Algorithm property.

src/Cuemon.AspNetCore.Authentication/Digest/DigestHashFactory.cs (1)

1-35: Well-designed factory implementation with good algorithm coverage

The new DigestHashFactory class provides a clean factory pattern implementation for creating hash instances based on digest algorithms. The mapping between DigestCryptoAlgorithm values and the appropriate hash implementations is straightforward and well-handled:

  • Properly maps both regular and session variants to their corresponding hash implementations
  • Uses proper exception handling for unsupported algorithms
  • Maintains good default value handling
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationOptions.cs (5)

30-32: LGTM! Documentation updated properly for the new DigestAlgorithm property

The documentation in the constructor has been correctly updated to reference the new DigestAlgorithm property.


61-61: Properly initializes the new DigestAlgorithm property

The constructor initializes the new property with the appropriate default value of DigestCryptoAlgorithm.Sha256.


106-107: Good use of obsolete attribute for the old Algorithm property

The obsolete attribute correctly informs developers that this property will be removed in a future version and provides guidance on using the new DigestAlgorithm property instead.


109-112: LGTM! New DigestAlgorithm property is well-documented

The property documentation clearly specifies its purpose and default value.


148-148: Documentation updated to reference the new enum type

The remarks for UseServerSideHa1Storage have been updated to reference DigestCryptoAlgorithm instead of the old enum type, maintaining documentation consistency.

test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs (4)

549-549: Test properly updated to use the new DigestAlgorithm property

The test code has been correctly updated to initialize the DigestAuthorizationHeaderBuilder with options.DigestAlgorithm instead of the deprecated options.Algorithm.


597-597: Test configuration updated to use the new enum type

The test configuration now uses DigestCryptoAlgorithm.Sha512Slash256 instead of UnkeyedCryptoAlgorithm.Sha512, correctly aligning with the API changes.


626-626: Header builder initialization updated to use the new DigestAlgorithm property

The initialization of DigestAuthorizationHeaderBuilder correctly uses the new options.DigestAlgorithm property.


705-705: LGTM! Consistent use of the new DigestAlgorithm property across tests

This test case also correctly uses the new options.DigestAlgorithm property, ensuring consistency across all test methods.

src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthenticationMiddleware.cs (2)

63-63: WWW-Authenticate header generation updated to use the new DigestAlgorithm property

The middleware now correctly uses Options.DigestAlgorithm instead of the deprecated Options.Algorithm when generating the WWW-Authenticate header.


140-159: ParseAlgorithm method updated to handle the new DigestCryptoAlgorithm enum

The method signature has been updated to accept DigestCryptoAlgorithm instead of UnkeyedCryptoAlgorithm, and the switch statement now handles all possible values of the new enum, including session variants with appropriate string representations.

This implementation:

  • Properly maps algorithm enums to their string representations
  • Handles session variants with the "-sess" suffix
  • Maintains compatibility with HTTP Digest Authentication specifications
  • Provides a sensible default for unrecognized values
src/Cuemon.AspNetCore.Authentication/Digest/DigestAuthorizationHeaderBuilder.cs (10)

2-2: Import usage looks appropriate.
The newly added System.ComponentModel import is needed for InvalidEnumArgumentException in the updated constructor.


17-22: Default constructor sets a secure default.
Having the parameterless constructor default to DigestCryptoAlgorithm.Sha256 is a good choice for a secure baseline algorithm.


29-49: Obsolete constructor implementation is consistent.
Deprecating the UnkeyedCryptoAlgorithm approach and mapping to the new DigestCryptoAlgorithm ensures backward compatibility while providing clear guidance to migrate.


50-54: New constructor aligns well with the updated pattern.
Accepting DigestCryptoAlgorithm directly is more intuitive and strongly typed.


75-76: Marking the old property as obsolete is appropriate.
The Algorithm property is clearly deprecated in favor of DigestAlgorithm.


78-82: Introducing a dedicated DigestAlgorithm property is a clean improvement.
Promoting this to a first-class property makes the code more readable and maintainable going forward.


203-203: Parsing into DigestAlgorithm ensures consistent usage.
You may want to confirm that header.Algorithm is never null or empty before calling ParseAlgorithm, but otherwise looks good.

Would you like to add a null-check for header.Algorithm?


214-223: ParseAlgorithm implementation covers all expected enum variants.
Throwing a NotSupportedException for unknown inputs is a safe approach.


244-244: Doc comments reflect the new property accurately.
They clearly convey usage of DigestAlgorithm in the computed hash value.


249-274: ComputeHash1 logic correctly trims SHA-512-256 results and handles session variants.
This ensures you only keep 256 bits from the 512-bit hash. Implementation is correct.

test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs (9)

28-35: Switching from [Fact] to [Theory] allows robust multi-algorithm testing.
This approach improves coverage by validating multiple digest algorithms in a single test method.


58-58: Use of o.DigestAlgorithm = algorithm; is consistent with the new pattern.
Replacing the obsolete property ensures correct usage of the updated approach.


82-82: Passing options.DigestAlgorithm into the builder is now aligned with options.
This harmonizes the test setup with production code usage.


111-118: Parameterized tests for QOP Authentication Integrity are comprehensive.
Implementing [Theory] with multiple DigestCryptoAlgorithm values ensures broad coverage of algorithm variants.


141-141: Assigning DigestAlgorithm in test ensures an accurate reference.
Demonstrates consistent usage across different test scenarios.


165-165: Same expression of DigestAlgorithm aligns with other test cases.
Ensures you are testing the correct property in a uniform manner.


206-206: Explicitly setting DigestAlgorithm to Sha512Slash256 confirms coverage for that variant.
This is beneficial for verifying server-side HA1 storage with a more complex algorithm.


212-212: Test data for HA1 is correct for Sha512Slash256.
The precomputed value effectively simulates a server-side stored HA1 hash.


270-270: Assertion verifies the correct algorithm is in effect.
This ensures the final environment is aligned with the intended DigestAlgorithm.

@codecov
Copy link

codecov bot commented Apr 13, 2025

Codecov Report

Attention: Patch coverage is 86.06965% with 28 lines in your changes missing coverage. Please review.

Project coverage is 80.17%. Comparing base (57bc994) to head (6f1a90b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ication/Digest/DigestAuthorizationHeaderBuilder.cs 56.52% 18 Missing and 2 partials ⚠️
src/Cuemon.Security.Cryptography/SHA512256.cs 95.48% 6 Missing ⚠️
...NetCore.Authentication/Digest/DigestHashFactory.cs 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   80.13%   80.17%   +0.04%     
==========================================
  Files         593      596       +3     
  Lines       18328    18513     +185     
  Branches     1884     1902      +18     
==========================================
+ Hits        14687    14843     +156     
- Misses       3573     3599      +26     
- Partials       68       71       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

@gimlichael gimlichael merged commit 8e7cd41 into main Apr 13, 2025
169 checks passed
@gimlichael gimlichael deleted the v9.0.5/digest--algorithm-support branch April 13, 2025 16:01
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.

2 participants