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

Change CorsConfig.enabled to optional and add logic to infer it #8038

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

tjquinno
Copy link
Member

@tjquinno tjquinno commented Nov 20, 2023

Description

Resolves #7990
Resolves #8024

The PR changes CorsConfig#enabled to optional so we can tell if the value is ever explicitly set--either from code or config--on the CorsSupport builder.

If so, we use the explicit setting.

If not, we set it as follows:

  • If no cors config was used, set enabled to false.
  • If cors config was used, set enabled to true.

This prevents the auto-discovered CORS logic from enabling permissive CORS settings by default.

Note that this changes the CorsConfig#enabled() method API. In 4.0.0 it returns boolean. With these changes it will return Optional<Boolean>.

Documentation

Bug fix - no doc change

Release note information

In 4.0.0, the CorsConfig.Builder had the method boolean enabled() to return the builder's setting for whether CORS is enabled or not in the builder.

In 4.0.1, the method on the builder has changed to Optional<Boolean> enabled() so the caller can tell whether or not CORS was explicitly enabled or disabled or whether defaults should apply.

@tjquinno tjquinno self-assigned this Nov 20, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 20, 2023
@tjquinno tjquinno merged commit 0be52f6 into helidon-io:main Nov 20, 2023
12 checks passed
@tjquinno tjquinno deleted the 4.x-cors-def branch November 20, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
2 participants