Enables CORS for spring security#957
Merged
aaronzi merged 1 commit intoeclipse-basyx:mainfrom Jan 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
CorsConfigurationSourcebean 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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