diff options
author | talig <talig@amdocs.com> | 2017-12-20 14:30:43 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-12-21 11:12:33 +0000 |
commit | 8e9c0653dd6c6862123c9609ae34e1206d86456e (patch) | |
tree | 5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main | |
parent | 785ebcc95de3e064e843bec04ba7a209d854fc7c (diff) |
Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main')
6 files changed, 102 insertions, 21 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java index 18465cd00c..e10f6a57ab 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java @@ -23,9 +23,6 @@ package org.openecomp.server.filters; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import java.io.IOException; -import java.security.Principal; -import java.util.Base64; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -35,6 +32,9 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.security.Principal; +import java.util.Base64; public class ActionAuthenticationFilter implements Filter { 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 82e4fa80d9..f54b06d46a 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 @@ -20,7 +20,6 @@ package org.openecomp.server.filters; -import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -29,6 +28,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; public class ActionAuthorizationFilter implements Filter { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java new file mode 100644 index 0000000000..b317fa6bf5 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java @@ -0,0 +1,45 @@ +package org.openecomp.server.filters; + +import org.openecomp.sdc.common.session.SessionContextProvider; +import org.openecomp.sdc.common.session.SessionContextProviderFactory; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; + +public class SessionContextFilter implements Filter { + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, + FilterChain filterChain) throws IOException, ServletException { + SessionContextProvider contextProvider = + SessionContextProviderFactory.getInstance().createInterface(); + + try { + if (servletRequest instanceof HttpServletRequest) { + String userName = ((HttpServletRequest) servletRequest).getHeader(USER_ID_HEADER_PARAM); + contextProvider.create(userName); + } + + filterChain.doFilter(servletRequest, servletResponse); + } finally { + contextProvider.close(); + } + } + + @Override + public void destroy() { + + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml index 8f4a2db73e..e43fa017d8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml @@ -36,24 +36,14 @@ <!-- aspect beans --> <bean id = "healthCheck" class="org.openecomp.sdcrests.health.rest.services.HealthCheckImpl"/> - <!--aop:config> - < aspect pointcuts> - <aop:pointcut id="loggingDebugPointcut" expression="execution(* org.openecomp.sdc.*.*.*(..))"/> - - <advices> - <aop:aspect id="logDebugAspect" ref="debugAspect"> - <aop:before pointcut-ref="loggingDebugPointcut" method="debugEnterMethod"/> - <aop:after-returning pointcut-ref="loggingDebugPointcut" method="debugExitMethod"/> - </aop:aspect> - </aop:config--> - - - - + <bean id = "itemPermissions" class="org.openecomp.sdcrests.itempermissions.rest.services.ItemPermissionsImpl"/> + <bean id = "notifications" class="org.openecomp.sdcrests.notifications.rest.services.impl.NotificationsImpl"/> <!-- RESTful Services --> <jaxrs:server id="restContainer" address="/"> <jaxrs:serviceBeans> + <ref bean="versions"/> + <ref bean="conflicts"/> <ref bean="vendorLicenseModels"/> <ref bean="licenseAgreements"/> <ref bean="featureGroups"/> @@ -75,9 +65,10 @@ <ref bean="deploymentFlavors"/> <ref bean="images"/> <ref bean="orchestrationTemplateCandidate"/> - <ref bean="componentDependencyModel"/> - <ref bean="activityLog"/> + <ref bean="componentDependencies"/> <ref bean="healthCheck"/> + <ref bean="itemPermissions"/> + <ref bean="notifications"/> </jaxrs:serviceBeans> <jaxrs:providers> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml new file mode 100644 index 0000000000..437df7945f --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml @@ -0,0 +1,13 @@ +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + + + <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> + <property name="mappings"> + <props> + </props> + </property> + </bean> + +</beans>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml index 35865f988e..de88197a8a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml @@ -23,6 +23,19 @@ </listener> <filter> + <filter-name>PermissionsFilter</filter-name> + <filter-class>org.openecomp.sdc.itempermissions.servlet.PermissionsFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>PermissionsFilter</filter-name> + <url-pattern>/v1.0/vendor-license-models/*</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>PermissionsFilter</filter-name> + <url-pattern>/v1.0/vendor-software-products/*</url-pattern> + </filter-mapping> + + <filter> <filter-name>cross-origin</filter-name> <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class> <init-param> @@ -68,6 +81,22 @@ <filter-name>LoggingServletFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + <filter> + <filter-name>SessionContextFilter</filter-name> + <filter-class>org.openecomp.server.filters.SessionContextFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>SessionContextFilter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + <!-- Spring WS Mapping --> + <servlet> + <servlet-name>spring-mapper</servlet-name> + <servlet-class> + org.springframework.web.servlet.DispatcherServlet + </servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> <!-- CXF --> <servlet> <servlet-name>CXFServlet</servlet-name> @@ -94,7 +123,10 @@ <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> - <!--servlet-name>logger-aspect</servlet-name--> + <servlet-name>spring-mapper</servlet-name> + <url-pattern>/ws/*</url-pattern> + </servlet-mapping> + <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> |