summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2017-12-27 15:46:30 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-27 14:55:54 +0000
commit5dffd0bb65ff1053055c2697e7cd198551c261cb (patch)
treed6b50dec16c4fdb359ccf885a2cebb8f675c2f55 /openecomp-be/api
parent2346d78c04a025d40ee2427944e3e1e2a669668a (diff)
Fixing sonar qube issues
Refactoring the code as per review comments. Change-Id: I1edd457f8d0989f815cbf3f28fa0a5124a8c4ac7 Issue-ID: SDC-343 Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'openecomp-be/api')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java35
1 files changed, 13 insertions, 22 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java
index f54b06d46a..181f7add88 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* 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.openecomp.server.filters;
@@ -32,29 +28,24 @@ import java.io.IOException;
public class ActionAuthorizationFilter implements Filter {
- private boolean runningOnLocal = true;
@Override
public void destroy() {
- // TODO Auto-generated method stub
+ //destroy() is not implemented for ActionAuthorizationFilter
}
@Override
- public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
+ FilterChain filterChain)
throws IOException, ServletException {
- if (runningOnLocal) {
- HttpServletRequest httpRequest = (HttpServletRequest) arg0;
- if (httpRequest.isUserInRole(httpRequest.getMethod().toUpperCase())) {
- arg2.doFilter(arg0, arg1);
- } else {
- setResponseStatus((HttpServletResponse) arg1, HttpServletResponse.SC_FORBIDDEN);
- }
+ HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
+ if (httpRequest.isUserInRole(httpRequest.getMethod().toUpperCase())) {
+ filterChain.doFilter(servletRequest, servletResponse);
} else {
- //call super doFilter of cadi authorization filter with relavant info as and when available
+ setResponseStatus((HttpServletResponse) servletResponse, HttpServletResponse.SC_FORBIDDEN);
}
-
}
private void setResponseStatus(HttpServletResponse response, int status) {
@@ -63,7 +54,7 @@ public class ActionAuthorizationFilter implements Filter {
@Override
public void init(FilterConfig arg0) throws ServletException {
-
+ //init() is not implemented for ActionAuthorizationFilter
}
}