Improve doc for Portal API configuration
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / config / WebSecurityConfiguration.java
index 4e1ddb4..edb80c8 100644 (file)
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.InvocationTargetException;
 
-import org.onap.portalsdk.core.onboarding.crossapi.PortalRestAPIProxy;
 import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
 import org.oransc.ric.portal.dashboard.LoginServlet;
@@ -61,8 +60,8 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
 
        // Although constructor arguments are recommended over field injection,
        // this results in fewer lines of code.
-       @Value("${userfile}")
-       private String userFilePath;
+       @Value("${portalapi.security}")
+       private Boolean portalapiSecurity;
        @Value("${portalapi.appname}")
        private String appName;
        @Value("${portalapi.username}")
@@ -73,6 +72,8 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
        private String decryptor;
        @Value("${portalapi.usercookie}")
        private String userCookie;
+       @Value("${userfile}")
+       private String userFilePath;
 
        protected void configure(HttpSecurity http) throws Exception {
                logger.debug("configure: portalapi.username {}", userName);
@@ -138,27 +139,11 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
        public PortalAuthenticationFilter portalAuthenticationFilterBean()
                        throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException,
                        IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
-               PortalAuthenticationFilter portalAuthenticationFilter = new PortalAuthenticationFilter(portalAuthManagerBean(),
-                               dashboardUserManagerBean());
+               PortalAuthenticationFilter portalAuthenticationFilter = new PortalAuthenticationFilter(portalapiSecurity,
+                               portalAuthManagerBean(), dashboardUserManagerBean());
                return portalAuthenticationFilter;
        }
 
-       /**
-        * Instantiates the EPSDK-FW servlet. Needed because this app is not configured
-        * to scan the EPSDK-FW packages; there's also a chance that Spring-Boot does
-        * not automatically process @WebServlet annotations.
-        * 
-        * @return Servlet registration bean for the Portal Rest API proxy servlet.
-        */
-       @Bean
-       public ServletRegistrationBean<PortalRestAPIProxy> portalApiProxyServletBean() {
-               PortalRestAPIProxy servlet = new PortalRestAPIProxy();
-               final ServletRegistrationBean<PortalRestAPIProxy> servletBean = new ServletRegistrationBean<>(servlet,
-                               PortalApiConstants.API_PREFIX + "/*");
-               servletBean.setName("PortalRestApiProxyServlet");
-               return servletBean;
-       }
-
        /**
         * Instantiates a trivial login servlet that serves a basic page with a link to
         * authenticate at Portal. The login filter redirects to this page instead of