Skip to content

Conversation

@aaronzi
Copy link
Member

@aaronzi aaronzi commented Jan 15, 2026

Description of Changes

This PR adds CORS to Spring security so that the same CORS settings for the individual components also apply when requests return for example a 401 or 403 status.

Related Issue

Closes #956

Copy link
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 enables CORS support in Spring Security to ensure CORS headers are properly applied to error responses (e.g., 401, 403 status codes). Previously, CORS was only configured for Spring MVC, which didn't cover authentication/authorization error responses handled by Spring Security.

Changes:

  • Added a new CorsConfigurationSource bean that mirrors the existing CORS configuration
  • Integrated the CORS configuration into Spring Security's filter chain

Reviewed changes

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

File Description
basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/BaSyxHTTPConfiguration.java Adds a new corsConfigurationSource bean method that creates a CorsConfigurationSource using the same CORS settings as the existing MVC configurer
basyx.common/basyx.authorization/src/main/java/org/eclipse/digitaltwin/basyx/authorization/CommonSecurityConfiguration.java Injects the CorsConfigurationSource bean and configures it in the Spring Security filter chain
Comments suppressed due to low confidence (1)

basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/BaSyxHTTPConfiguration.java:1

  • The Javadoc is incomplete. The @param tags lack descriptions, and the @return tag is empty. Add descriptions for each parameter and document what the method returns (e.g., 'A CorsConfigurationSource configured with the specified origins, methods, and path patterns').
/*******************************************************************************

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aaronzi aaronzi merged commit 62bed8c into eclipse-basyx:main Jan 15, 2026
93 of 99 checks passed
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.

[BUG] Error responses are missing CORS headers

1 participant