From 3cb0d59b9050b3a9861622c622fb861aaa43a684 Mon Sep 17 00:00:00 2001 From: Meetesh Barua Date: Wed, 8 Jul 2020 15:17:19 -0700 Subject: [PATCH] Removed OPTION omission for CORS --- .../java/io/confluent/rest/auth/AuthUtil.java | 3 --- .../io/confluent/rest/auth/AuthUtilTest.java | 26 ------------------- 2 files changed, 29 deletions(-) diff --git a/core/src/main/java/io/confluent/rest/auth/AuthUtil.java b/core/src/main/java/io/confluent/rest/auth/AuthUtil.java index bdaffcb1d5..d25fcd28aa 100644 --- a/core/src/main/java/io/confluent/rest/auth/AuthUtil.java +++ b/core/src/main/java/io/confluent/rest/auth/AuthUtil.java @@ -128,9 +128,6 @@ private static ConstraintMapping createConstraint( final ConstraintMapping mapping = new ConstraintMapping(); mapping.setConstraint(constraint); mapping.setMethod("*"); - if (authenticate && AuthUtil.isCorsEnabled(restConfig)) { - mapping.setMethodOmissions(new String[]{"OPTIONS"}); - } mapping.setPathSpec(pathSpec); return mapping; } diff --git a/core/src/test/java/io/confluent/rest/auth/AuthUtilTest.java b/core/src/test/java/io/confluent/rest/auth/AuthUtilTest.java index 2c0221ca32..27e59235ba 100644 --- a/core/src/test/java/io/confluent/rest/auth/AuthUtilTest.java +++ b/core/src/test/java/io/confluent/rest/auth/AuthUtilTest.java @@ -75,32 +75,6 @@ public void shouldCreateGlobalConstraintToCoverAllMethods() { assertThat(mapping.getMethod(), is("*")); } - @Test - public void shouldCreateGlobalConstraintWithNoMethodsOmittedForNonCor() { - // Given: - config = restConfigWith(ImmutableMap.of( - RestConfig.ACCESS_CONTROL_ALLOW_ORIGIN_CONFIG, "")); - - // When: - final ConstraintMapping mapping = AuthUtil.createGlobalAuthConstraint(config); - - // Then: - assertThat(mapping.getMethodOmissions(), is(nullValue())); - } - - @Test - public void shouldCreateGlobalConstraintWithOptionsOmittedForCor() { - // Given: - config = restConfigWith(ImmutableMap.of( - RestConfig.ACCESS_CONTROL_ALLOW_ORIGIN_CONFIG, "something")); - - // When: - final ConstraintMapping mapping = AuthUtil.createGlobalAuthConstraint(config); - - // Then: - assertThat(mapping.getMethodOmissions(), is(new String[]{"OPTIONS"})); - } - @Test public void shouldCreateGlobalConstraintWithAuthRequired() { // When: