Skip to content

Extends support for CORS in CrudApiPlugin to action-level auth#1199

Merged
waldekmastykarz merged 1 commit intodotnet:mainfrom
waldekmastykarz:crudapi-auth-actions
May 22, 2025
Merged

Extends support for CORS in CrudApiPlugin to action-level auth#1199
waldekmastykarz merged 1 commit intodotnet:mainfrom
waldekmastykarz:crudapi-auth-actions

Conversation

@waldekmastykarz
Copy link
Copy Markdown
Collaborator

No description provided.

@waldekmastykarz waldekmastykarz requested a review from a team as a code owner May 21, 2025 12:47
@garrytrinder garrytrinder requested a review from Copilot May 21, 2025 13:27
Copy link
Copy Markdown
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 extends the CORS header logic in CrudApiPlugin to also recognize action-level Entra authentication.

  • Adds a check for any action with CrudApiAuthType.Entra before including the authorization header in CORS responses.
Comments suppressed due to low confidence (2)

dev-proxy-plugins/Mocks/CrudApiPlugin.cs:220

  • Add or update unit tests to cover the scenario where an action has CrudApiAuthType.Entra, ensuring the access-control-allow-headers header is correctly added.
if (_configuration.EntraAuthConfig is not null || _configuration.Actions.Any(a => a.Auth == CrudApiAuthType.Entra))

dev-proxy-plugins/Mocks/CrudApiPlugin.cs:222

  • Potential NullReferenceException if _configuration.Actions is null. Consider using a null-conditional operator (e.g., _configuration.Actions?.Any(...) == true) or ensure Actions is always initialized.
_configuration.Actions.Any(a => a.Auth == CrudApiAuthType.Entra)

@waldekmastykarz waldekmastykarz merged commit fbe83d1 into dotnet:main May 22, 2025
4 checks passed
@waldekmastykarz waldekmastykarz deleted the crudapi-auth-actions branch May 22, 2025 06:00
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.

3 participants