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

Allow RS512 as valid signing algorithm #2176

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

m-gug
Copy link

@m-gug m-gug commented Mar 10, 2024

What this PR does / why we need it:
The current implementation of the OpenIdConnect health check requires that the server supports RS256 as a signing algorithm.
If the server only supports RS512, the health check will fail.
This PR extends the checking of permitted signature algorithms to include RS512 (others can be added to the constant).

Which issue(s) this PR fixes:

#2175

Special notes for your reviewer:
The test be_healthy_if_idsvr_is_available fails in my setup - i guess it needs a running OIDC Server?

Does this PR introduce a user-facing change?:
No

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Unit tests passing
  • End-to-end tests passing
  • Extended the documentation
  • Provided sample for the feature

…thms in the `DiscoveryEndpointResponse` class and the addition of "RS512" as a required algorithm in the `OidcConstants` class. A new test method has also been added to the `discovery_endpoint_response_should` class to test the validation of the `DiscoveryEndpointResponse` when one of the required signing algorithms is provided.

1. The `DiscoveryEndpointResponse` class in `DiscoveryEndpointResponse.cs` now uses the `ValidateOneOfRequiredValues` method instead of `ValidateRequiredValues` for `SigningAlgorithmsSupported`. This allows for the validation of multiple signing algorithms rather than just one.

2. The `OidcConstants` class in `OidcConstants.cs` has been updated to include "RS512" as a required algorithm, in addition to "RS256". This expands the list of required signing algorithms.

3. The `discovery_endpoint_response_should` class in `DiscoveryEndpointResponseTests.cs` has been updated with a new test method `be_valid_when_one_required_id_token_signing_alg_value_is_provided`. This method tests the validation of the `DiscoveryEndpointResponse` when one of the required signing algorithms is provided. It uses the `InlineData` attribute to test with both "RS256" and "RS512". The error message in the `validate` action has also been updated to reflect these changes.
@m-gug
Copy link
Author

m-gug commented Mar 10, 2024

@dotnet-policy-service agree

@m-gug m-gug changed the title The most significant changes involve the validation of signing algori… Allow RS512 as valid signing algorithm Mar 12, 2024
@m-gug
Copy link
Author

m-gug commented Mar 18, 2024

I have added the possibility that the signature algorithms can be passed as parameters.
It's not the prettiest implementation, but it's backwards compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant