aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-08-04 18:03:29 +0300
committerIttay Stern <ittay.stern@att.com>2019-08-04 15:11:25 +0000
commitc459c7efeafd556333c46c65fc4fe2616d3ef532 (patch)
tree74da52be5a3825bbea5c9c667ad3c5821af99bdd /vid-app-common/src/main/java/org
parente8e72260254d2399279a1497c14abafc06018037 (diff)
Remove web-filter for incoming scheduler requests
authentication can be handled in a different way like using AAF (see 48b0c6ee) Issue-ID: VID-378 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: I68c664bc6a20ce4d8722558e00985b7638fed04b
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/filter/ClientCredentialsFilter.java82
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerProperties.java3
2 files changed, 0 insertions, 85 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/filter/ClientCredentialsFilter.java b/vid-app-common/src/main/java/org/onap/vid/controller/filter/ClientCredentialsFilter.java
deleted file mode 100644
index f1129057f..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/controller/filter/ClientCredentialsFilter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.controller.filter;
-
-import org.apache.commons.lang3.StringUtils;
-import org.onap.vid.scheduler.SchedulerProperties;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.util.SystemProperties;
-import org.springframework.web.filter.GenericFilterBean;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.annotation.WebFilter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * Created by amichai on 13/05/2018.
- */
-@WebFilter(urlPatterns = "/change-management/workflow/*")
-public class ClientCredentialsFilter extends GenericFilterBean {
-
- private static final EELFLoggerDelegate filterLogger = EELFLoggerDelegate.getLogger(ClientCredentialsFilter.class);
-
-
- @Override
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
-
- if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse))
- return;
-
- String expectedAuthorization = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_BASIC_AUTH);
- String actualAuthorization = ((HttpServletRequest)request).getHeader("Authorization");
-
- if (verifyClientCredentials(actualAuthorization, expectedAuthorization)) {
- filterLogger.warn(EELFLoggerDelegate.debugLogger,"Client credentials authenticated.");
- chain.doFilter(request, response);
- return;
- }
-
- filterLogger.warn(EELFLoggerDelegate.debugLogger,"Client did not provide the expected credentials.");
- ((HttpServletResponse) response).sendError(401);
- }
-
- public boolean verifyClientCredentials(String actualAuthorization, String expectedAuthorization)
- {
- if (StringUtils.isEmpty(expectedAuthorization))
- {
- filterLogger.warn(EELFLoggerDelegate.debugLogger,String.format("Expected Authorization is not configured (key: %s)", SchedulerProperties.SCHEDULER_BASIC_AUTH));
- return true;
- }
-
- if (StringUtils.isEmpty(actualAuthorization))
- {
- filterLogger.warn(EELFLoggerDelegate.debugLogger,"Authorization header is missing.");
- return false;
- }
-
- return actualAuthorization.equals(expectedAuthorization);
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerProperties.java b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerProperties.java
index 8974032b3..400e8d942 100644
--- a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerProperties.java
@@ -35,7 +35,4 @@ public class SchedulerProperties extends SystemProperties {
public static final String SCHEDULER_DELETE_SCHEDULE = "scheduler.delete.schedule";
- public static final String SCHEDULER_BASIC_AUTH = "scheduler.basic.auth";
-
-
}