printFooterInDownload = nvls(
raptorProperties.getProperty("print_footer_in_download"), "no")
.toUpperCase().startsWith("Y");
- footerFirstLine = nvls(raptorProperties.getProperty("footer_first_line"), "AT&T Proprietary");
+ footerFirstLine = nvls(raptorProperties.getProperty("footer_first_line"), "Raptor report");
footerSecondLine = nvls(raptorProperties.getProperty("footer_second_line"), "Use Pursuant to Company Instructions");
reportsInPoPUpWindow = nvls(
raptorProperties.getProperty("report_in_popup_window"), "no")
- PORTAL-72 Address Sonar Scan code issues
- PORTAL-90 Use approved ONAP license text
- Portal-86 Remove application specific usages from tests and other files
+- PORTAL-78 Fix SingleSignon by force session creation prior to redirection to portal
Version 1.3.0, 28 August 2017
final String redirectUrl = portalUrl + "?uebAppKey=" + uebAppKey + "&redirectUrl=" + encodedReturnToAppUrl;
logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: portal-bound redirect URL is {}",
redirectUrl);
+
+ // this line may not be necessary but jsessionid coockie is not getting created in all cases;
+ // so force the cookie creation
+ request.getSession(true);
+
return new ModelAndView("redirect:" + redirectUrl);
}
}
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller.core;
/**
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller.sample;
/**
import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestAPIService;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
import org.onap.portalsdk.core.restful.domain.EcompRole;
import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.onap.portalsdk.core.service.RestApiRequestBuilder;
import org.onap.portalsdk.core.service.RoleService;
import org.onap.portalsdk.core.service.UserProfileService;
+import org.onap.portalsdk.core.service.UserService;
import org.onap.portalsdk.core.service.WebServiceCallService;
import org.onap.portalsdk.core.util.JSONUtil;
import org.onap.portalsdk.core.util.SystemProperties;
import org.slf4j.MDC;
import org.springframework.context.ApplicationContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
/**
* Implements the REST API interface to answer requests made by Portal app about
* users and active sessions.
private IAdminAuthExtension adminAuthExtensionServiceImpl;
private LoginStrategy loginStrategy;
-
+ private UserService userService;
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ private static final String isAccessCentralized = PortalApiProperties
+ .getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED);
+
+ private static final String isCentralized = "remote";
+
public OnBoardingApiServiceImpl() {
// Defend against null-pointer exception during server startup
// that was caused by a spurious Spring annotation on this class.
loginStrategy = appContext.getBean(LoginStrategy.class);
// initialize the base class definition for Admin Auth Extension
adminAuthExtensionServiceImpl = appContext.getBean(IAdminAuthExtension.class);
+ userService = appContext.getBean(UserService.class);
+ if(isCentralized.equals(isAccessCentralized)){
+ restApiRequestBuilder = appContext.getBean(RestApiRequestBuilder.class);
+ }
}
private void setCurrentAttributes(User user, EcompUser userJson) {
try {
if (logger.isDebugEnabled())
logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId);
- User user = userProfileService.getUserByLoginId(loginId);
+
+ User user = null;
+ if(isCentralized.equals(isAccessCentralized)){
+ String responseString = restApiRequestBuilder.getViaREST("/user/" + loginId, true, loginId);
+ user = userService.userMapper(responseString);
+ }
+ else{
+ user = userProfileService.getUserByLoginId(loginId);
+ }
if (user == null) {
logger.info(EELFLoggerDelegate.debugLogger, "User + " + loginId + " doesn't exist");
return null;
@Override
public List<EcompUser> getUsers() throws PortalAPIException {
+ String users_List = "";
try {
- List<User> users = userProfileService.findAllActive();
- List<EcompUser> ecompUsers = new ArrayList<EcompUser>();
- for (User user : users)
- ecompUsers.add(UserUtils.convertToEcompUser(user));
- return ecompUsers;
+ if (isCentralized.equals(isAccessCentralized)) {
+ List<EcompUser> UsersList = new ArrayList<>();
+ List<EcompUser> finalUsersList = new ArrayList<>();
+ users_List = restApiRequestBuilder.getViaREST("/users", true, null);
+ ObjectMapper mapper = new ObjectMapper();
+ UsersList = mapper.readValue(users_List,
+ TypeFactory.defaultInstance().constructCollectionType(List.class, EcompUser.class));
+ for (EcompUser userString : UsersList) {
+ EcompUser ecompUser = mapper.convertValue(userString, EcompUser.class);
+ finalUsersList.add(ecompUser);
+ }
+ return UsersList;
+ }
+ else {
+ List<User> users = userProfileService.findAllActive();
+ List<EcompUser> ecompUsers = new ArrayList<EcompUser>();
+ for (User user : users)
+ ecompUsers.add(UserUtils.convertToEcompUser(user));
+ return ecompUsers;
+ }
} catch (Exception e) {
String response = "OnboardingApiService.getUsers failed";
logger.error(EELFLoggerDelegate.errorLogger, response, e);
- throw new PortalAPIException(response, e);
+ if (users_List.equals("")) {
+ throw new PortalAPIException("Application is Inactive");
+ } else {
+ throw new PortalAPIException(response, e);
+ }
}
}
logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId);
List<EcompRole> ecompRoles = new ArrayList<EcompRole>();
try {
+
+ if(isCentralized.equals(isAccessCentralized)){
+ User user = null;
+ String responseString = restApiRequestBuilder.getViaREST("/user/" + loginId, true, loginId);
+ user = userService.userMapper(responseString);
+ SortedSet<Role> currentRoles = null;
+ if (user != null) {
+ currentRoles = user.getRoles();
+ if (currentRoles != null)
+ for (Role role : currentRoles)
+ ecompRoles.add(UserUtils.convertToEcompRole(role));
+ }
+ }
+ else{
User user = userProfileService.getUserByLoginId(loginId);
SortedSet<Role> currentRoles = null;
if (user != null) {
for (Role role : currentRoles)
ecompRoles.add(UserUtils.convertToEcompRole(role));
}
+ }
return ecompRoles;
} catch (Exception e) {
String response = "OnboardingApiService.getUserRoles failed";
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp;
import org.junit.Assert;
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller;
import org.junit.Assert;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+public class CollaborationControllerTest extends MockApplicationContextTestSuite {
-
-public class CollaborationControllerTest extends MockApplicationContextTestSuite{
-
@Test
public void testGetAvailableRoles() throws Exception {
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/collaborate_list");
User user = new User();
user.setId(1l);
- //user.setOrgUserId("abc");
+ // user.setOrgUserId("abc");
requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
-
- ResultActions ra =getMockMvc().perform(requestBuilder);
- Assert.assertEquals(2,ra.andReturn().getModelAndView().getModelMap().size());
- }
+ ResultActions ra = getMockMvc().perform(requestBuilder);
+ Assert.assertEquals(2, ra.andReturn().getModelAndView().getModelMap().size());
+ }
}
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller;
import org.junit.Assert;
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.core;
import java.io.IOException;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-
-
/**
- *
- *
- *
- * In order to write a unit test,
- * 1. inherit this class - See SanityTest.java
- * 2. place the "war" folder on your test class's classpath
- * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path
- * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath
- * -Dcontainer.classpath="classpath:"
+ * In order to write a unit test, 1. inherit this class - See SanityTest.java 2.
+ * place the "war" folder on your test class's classpath 3. run the test with
+ * the following VM argument; This is important because when starting the
+ * application from Container, the System Properties file
+ * (SystemProperties.java) can have the direct path but, when running from the
+ * Mock Junit container, the path should be prefixed with "classpath" to enable
+ * the mock container to search for the file in the classpath
+ * -Dcontainer.classpath="classpath:"
*
*/
-
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
-@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class})
-@ActiveProfiles(value="test")
+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class })
+@ActiveProfiles(value = "test")
public class MockApplicationContextTestSuite {
-
- @Autowired
- public WebApplicationContext wac;
-
- private MockMvc mockMvc;
-
- @Before
- public void setup() {
- if(mockMvc == null) {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
-
- }
- }
-
- public Object getBean(String name) {
- return this.wac.getBean(name);
- }
+ @Autowired
+ public WebApplicationContext wac;
- public MockMvc getMockMvc() {
- return mockMvc;
- }
+ private MockMvc mockMvc;
+
+ @Before
+ public void setup() {
+ if (mockMvc == null) {
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
- public void setMockMvc(MockMvc mockMvc) {
- this.mockMvc = mockMvc;
- }
-
- public WebApplicationContext getWebApplicationContext() {
- return wac;
}
-
-
-
-
+ }
+
+ public Object getBean(String name) {
+ return this.wac.getBean(name);
+ }
+
+ public MockMvc getMockMvc() {
+ return mockMvc;
+ }
+
+ public void setMockMvc(MockMvc mockMvc) {
+ this.mockMvc = mockMvc;
+ }
+
+ public WebApplicationContext getWebApplicationContext() {
+ return wac;
+ }
+
}
-
-
- @Configuration
- @ComponentScan(basePackages = "org.onap",
- excludeFilters = {
- }
- )
- @Profile("test")
- class MockAppConfig extends AppConfig {
-
- @Bean
- public SystemProperties systemProperties(){
- return new MockSystemProperties();
- }
-
- @Bean
- public AbstractCacheManager cacheManager() {
- return new CacheManager() {
-
- public void configure() throws IOException {
-
- }
- };
- }
-
- protected String[] tileDefinitions() {
- return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"};
- }
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
- //registry.addInterceptor(resourceInterceptor());
+
+@Configuration
+@ComponentScan(basePackages = "org.onap", excludeFilters = {})
+@Profile("test")
+class MockAppConfig extends AppConfig {
+
+ @Bean
+ public SystemProperties systemProperties() {
+ return new MockSystemProperties();
+ }
+
+ @Bean
+ public AbstractCacheManager cacheManager() {
+ return new CacheManager() {
+
+ public void configure() throws IOException {
+
}
-
- public static class MockSystemProperties extends SystemProperties {
-
- public MockSystemProperties() {
- }
-
- }
-
+ };
+ }
+
+ protected String[] tileDefinitions() {
+ return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml",
+ "classpath:/WEB-INF/defs/definitions.xml" };
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ // registry.addInterceptor(new
+ // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
+ // registry.addInterceptor(resourceInterceptor());
+ }
+
+ public static class MockSystemProperties extends SystemProperties {
+
+ public MockSystemProperties() {
}
-
-
+ }
+}
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.service;
import java.util.List;
import org.onap.portalsdk.core.service.UserProfileService;
import org.springframework.beans.factory.annotation.Autowired;
-
-
-
public class ProfileServiceTest extends MockApplicationContextTestSuite {
-
+
@Autowired
ProfileService service;
-
+
@Autowired
UserProfileService userProfileService;
-
+
@Test
- public void testFindAll() throws Exception{
-
+ public void testFindAll() throws Exception {
+
List<Profile> profiles = service.findAll();
Assert.assertTrue(profiles.size() > 0);
}
@Test
public void testFindAllActive() {
-
+
List<User> users = userProfileService.findAllActive();
List<User> activeUsers = userProfileService.findAllActive();
Assert.assertTrue(users.size() - activeUsers.size() >= 0);
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.workflow.services;
import java.util.Calendar;
import org.onap.portalsdk.workflow.services.WorkflowScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
-
-
public class WorkflowScheduleServiceTest extends MockApplicationContextTestSuite {
-
+
@Autowired
WorkflowScheduleService service;
-// @Autowired
-// SchedulerFactoryBean schedulerBean;
-
+
@Test
public void testFire() {
-
- // List<WorkflowSchedule> wfs = service.findAll();
-
+
final WorkflowSchedule ws = new WorkflowSchedule();
ws.setId(999L);
ws.setWorkflowKey("test");
final Calendar instance = Calendar.getInstance();
instance.add(Calendar.YEAR, 3);
ws.setEndDateTime(instance.getTime());
-
+
ws.setStartDateTime(Calendar.getInstance().getTime());
- try{
+ try {
service.saveWorkflowSchedule(ws);
Assert.assertTrue(true);
- } catch(Exception e) {
+ } catch (Exception e) {
Assert.fail(e.getMessage());
}
-
+
}
}
- PORTAL-72 Address Sonar Scan code issues
- PORTAL-79 remove unwanted SDK left menu under Report-sample dashboard
- PORTAL-90 Use approved ONAP license text
-- Portal-86 Remove application specific usages from tests and other files
+- Portal-86 Remove application specific usages from tests and other files (rework)
* Put new entries here *
+++ /dev/null
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalapp.lm;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-
-import org.onap.portalsdk.core.lm.FusionLicenseManager;
-import org.springframework.stereotype.Component;
-
-/*
- * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface.
- */
-
-@Component
-public class FusionLicenseManagerImpl implements FusionLicenseManager {
-
- @Override
- public void initKeyStoreParam() {
- // a dummy stub for the interface
- }
-
- @Override
- public void initCipherParam() {
- // a dummy stub for the interface
- }
-
- @Override
- public void initLicenseParam() {
- // a dummy stub for the interface
- }
-
- @Override
- public void doInitWork() {
- // a dummy stub for the interface
- }
-
- @Override
- public int installLicense() {
- return 0;
- }
-
- @Override
- public synchronized int verifyLicense(ServletContext context) {
- return 0;
- }
-
- @Override
- public void generateLicense(Map<String, String> clientInfoMap, List<String> ipAddressList) throws Exception {
- // a dummy stub for the interface
- }
-
- @Override
- public String nvl(String s) {
- return null;
- }
-
- @Override
- public Date getExpiredDate() {
- return null;
- }
-
- @Override
- public void setExpiredDate(Date expiredDate) {
- // a dummy stub for the interface
- }
-
-}
+++ /dev/null
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalapp.lm;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import org.onap.portalsdk.core.lm.LicenseableClass;
-
-/*
- * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface.
- */
-public class LicenseableClassImpl implements LicenseableClass {
-
- @Override
- public String getApplicationName() {
- return "";
- }
-
- @Override
- public InputStream getPublicKeystoreAsInputStream() throws FileNotFoundException {
- return null;
- }
-
- @Override
- public String getAlias() {
- return "";
- }
-
- @Override
- public String getKeyPasswd() {
- return "";
- }
-
- @Override
- public String getPublicKeystorePassword() {
- return "";
- }
-
- @Override
- public String getCipherParamPassword() {
- return "";
- }
-
- @Override
- @SuppressWarnings("rawtypes")
- public Class getClassToLicense() {
- return this.getClass();
- }
-
-}
if (containerRowCol != null && containerRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) {
Container c = containerRowCol.get(String.valueOf(i) + String.valueOf(j));
Position p = new Position();
- if (this.getName().equals("VNI")) {
- p.x = j * (interContWd - 2) + xsum + domainToLayoutWd;
- } else
- p.x = j * interContWd + xsum + domainToLayoutWd;
+ p.x = j * interContWd + xsum + domainToLayoutWd;
double ysum = 0;
for (int k = 0; k < i; k++) {
if (containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j)))
ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize()
.getHeight();
-
- else if (j > 0 && containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j - 1))
- && !containerRowCol.get(String.valueOf(i) + String.valueOf(j)).getName()
- .equals("AIC - Alpharetta")) {
- ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j - 1)).computeSize()
- .getHeight();
- }
}
p.y = domainToLayoutH + ysum + this.computeSize().getHeight() + domainToContH + i * interContH;
c.setP(p);
else
newX = domainstoUpd.get(i).getP().getX() + 38;
- if (d.getName().equals("Datacenter with AIC"))
- newX += 5;
d.setDomainToLayoutWd(newX);
d.computeConatinerPositions();
+++ /dev/null
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.listener;
-
-import javax.servlet.ServletContext;
-import javax.servlet.annotation.WebListener;
-
-import org.onap.portalsdk.core.lm.FusionLicenseManagerUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.stereotype.Component;
-
-@WebListener
-@Component
-public class ApplicationContextListener implements ApplicationListener<ContextRefreshedEvent> {
-
- @Autowired
- private ServletContext context;
- @Autowired
- private FusionLicenseManagerUtils fusionLicenseManagerUtils;
-
- @Override
- public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
- int licenseStatus = fusionLicenseManagerUtils.verifyLicense(context);
- context.setAttribute("licenseVerification", licenseStatus);
- }
-
-}
+++ /dev/null
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.lm;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-
-public interface FusionLicenseManager {
-
- public static final int DEVELOPER_LICENSE = 0;
- public static final int EXPIRED_LICENSE = 1;
- public static final int VALID_LICENSE = 2;
- public static final int INVALID_LICENSE = 3;
- public static final int OPENSOURCE_LICENSE = 4;
-
- public void initKeyStoreParam();
-
- public void initCipherParam();
-
- public void initLicenseParam();
-
- public void doInitWork();
-
- public int installLicense();
-
- public int verifyLicense(ServletContext context);
-
- public void generateLicense(Map<String, String> clientInfoMap, List<String> ipAddressList) throws Exception;
-
- public String nvl(String s);
-
- public Date getExpiredDate();
-
- public void setExpiredDate(Date expiredDate);
-}
\ No newline at end of file
+++ /dev/null
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.lm;
-
-import java.util.Date;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.onap.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.servlet.support.RequestContextUtils;
-
-@Component
-public class FusionLicenseManagerUtils {
-
- @Autowired
- private FusionLicenseManager licenseManager;
-
- @Autowired
- private SystemProperties sysProps;
-
- public int verifyLicense(ServletContext context) {
- if (sysProps == null) {
- try {
- sysProps = new SystemProperties();
- sysProps.setServletContext(context);
- System.out.println(licenseManager);
- licenseManager.installLicense();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- return licenseManager.verifyLicense(context);
- }
-
- public static Date getLicenseExpiryDate(HttpServletRequest request) {
- WebApplicationContext ctx = RequestContextUtils.getWebApplicationContext(request);
- return ((FusionLicenseManager) ctx.getBean("fusionLicenseManager")).getExpiredDate();
- }
-}
+++ /dev/null
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.lm;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * created by Alvin Alexander of http://devdaily.com. modified by Sundar
- * Ramalingam
- */
-public interface LicenseableClass {
- public String getApplicationName();
-
- public InputStream getPublicKeystoreAsInputStream() throws FileNotFoundException;
-
- public String getAlias();
-
- public String getPublicKeystorePassword();
-
- public String getKeyPasswd();
-
- public String getCipherParamPassword();
-
- public Class getClassToLicense();
-
-}
// Used to build image file relative URLs
final String iconRelPath = SystemProperties.getProperty("element_map_icon_path");
- Map<String, Domain> resultAICDomain = layout.getDomainRowCol();
+ Map<String, Domain> resultDomain = layout.getDomainRowCol();
Map<String, List<Domain>> domainMap = new HashMap<>();
List<Domain> domainList = new ArrayList<>();
- for (Domain d : resultAICDomain.values()) {
+ for (Domain d : resultDomain.values()) {
d.setWidth(10 * d.computeSize().getWidth());
d.setHeight(10 * d.computeSize().getHeight());
d.setLeft(10 * d.getP().getX());
return dirContext;
}
- // Get an LDAP directory context - LDAPv3-style
- /*
- * public InitialLdapContext getLdapContext() { //throws NamingException { if
- * (ldapContext == null) { Properties properties = new Properties(); // @todo -
- * need to parameterize context factoy class and url
- * properties.put(Context.INITIAL_CONTEXT_FACTORY,
- * AttLdap.DIR_INITIAL_CONTEXT_FACTORY); properties.put(Context.PROVIDER_URL,
- * AttLdap.DIR_PROVIDER_URL); properties.put(Context.SECURITY_PRINCIPAL,
- * AttLdap.DIR_SECURITY_PRINCIPAL); Control[] ctrl = null; try { ldapContext =
- * new InitialLdapContext(properties, ctrl); } catch (NamingException ne) { //
- * MJ FIX log exception? } } return ldapContext; }
- */
-
}
import org.onap.portalsdk.core.domain.RoleFunction;
import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.exception.SessionExpiredException;
-import org.onap.portalsdk.core.lm.FusionLicenseManager;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.menu.MenuBuilder;
import org.onap.portalsdk.core.restful.domain.EcompRole;
String displayName = "";
if (SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME) != null)
displayName = SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME);
- switch (licenseVarificationFlag) {
- case FusionLicenseManager.DEVELOPER_LICENSE:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME),
- displayName + " [Development Version]");
- break;
- case FusionLicenseManager.EXPIRED_LICENSE:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME),
- displayName + " [LICENSE EXPIRED]");
- break;
- case FusionLicenseManager.VALID_LICENSE:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), displayName);
- break;
- default:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME),
- displayName + " [INVALID LICENSE]");
- break;
- }
-
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), displayName);
session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME),
MenuBuilder.filterMenu(applicationMenuData, request));
session.setAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME),
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.fusion.core;
import java.io.IOException;
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.fusion.core;
import org.onap.portalsdk.core.conf.HibernateMappingLocatable;
* Client-supplied class that implements our interface.
*/
private static IPortalRestAPIService portalRestApiServiceImpl;
+ private static final String isAccessCentralized = PortalApiProperties
+ .getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED);
+ private static final String errorMessage = "Access Management is not allowed for Centralized applications." ;
+ private static final String isCentralized = "remote";
+
public PortalRestAPIProxy() {
// Ensure that any additional fields sent by the Portal
// Example: /user <-- create user
if (requestUri.endsWith(PortalApiConstants.API_PREFIX + "/user")) {
try {
- EcompUser user = mapper.readValue(requestBody, EcompUser.class);
- pushUser(user);
- logger.debug("doPost: pushUser: success");
- responseJson = buildJsonResponse(true, null);
- response.setStatus(HttpServletResponse.SC_OK);
+ if (isCentralized.equals(isAccessCentralized)) {
+ responseJson = buildJsonResponse(true, errorMessage);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ EcompUser user = mapper.readValue(requestBody, EcompUser.class);
+ pushUser(user);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: pushUser: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
} catch (Exception ex) {
responseJson = buildJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
if (requestUri.contains(PortalApiConstants.API_PREFIX + "/user/") && !(requestUri.endsWith("/roles"))) {
String loginId = requestUri.substring(requestUri.lastIndexOf('/') + 1);
try {
- EcompUser user = mapper.readValue(requestBody, EcompUser.class);
- editUser(loginId, user);
- logger.debug("doPost: editUser: success");
- responseJson = buildJsonResponse(true, null);
- response.setStatus(HttpServletResponse.SC_OK);
+ if (isCentralized.equals(isAccessCentralized)) {
+ responseJson = buildJsonResponse(true, errorMessage);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ EcompUser user = mapper.readValue(requestBody, EcompUser.class);
+ editUser(loginId, user);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: editUser: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
} catch (Exception ex) {
responseJson = buildJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
String loginId = requestUri.substring(requestUri.indexOf("/user/") + ("/user").length() + 1,
requestUri.lastIndexOf('/'));
try {
- TypeReference<List<EcompRole>> typeRef = new TypeReference<List<EcompRole>>() {
- };
- List<EcompRole> roles = mapper.readValue(requestBody, typeRef);
- pushUserRole(loginId, roles);
- logger.debug("doPost: pushUserRole: success");
- responseJson = buildJsonResponse(true, null);
- response.setStatus(HttpServletResponse.SC_OK);
+ if (isCentralized.equals(isAccessCentralized)) {
+ responseJson = buildJsonResponse(true, errorMessage);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ TypeReference<List<EcompRole>> typeRef = new TypeReference<List<EcompRole>>() {
+ };
+ List<EcompRole> roles = mapper.readValue(requestBody, typeRef);
+ pushUserRole(loginId, roles);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: pushUserRole: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
} catch (Exception ex) {
responseJson = buildJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
*/
if (requestUri.endsWith("/sessionTimeOuts")) {
- responseJson = getSessionTimeOuts();
- if (responseJson != null && responseJson.length() > 0) {
+ try {
+ responseJson = getSessionTimeOuts();
logger.debug("doGet: got session timeouts");
response.setStatus(HttpServletResponse.SC_OK);
- } else {
+ } catch(Exception ex) {
String msg = "Failed to get session time outs";
logger.error("doGet: " + msg);
responseJson = buildJsonResponse(false, msg);
if (logger.isDebugEnabled())
logger.debug("doGet: getUsers: " + responseJson);
} catch (Exception ex) {
- responseJson = buildJsonResponse(ex);
+ responseJson = buildShortJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
logger.error("doGet: getUsers: caught exception", ex);
}
t.printStackTrace(pw);
return buildJsonResponse(false, sw.toString());
}
+
+ private String buildShortJsonResponse(Throwable t)
+ {
+ String errorMessage = t.getMessage();
+ return buildJsonResponse(false, errorMessage);
+ }
@Override
public String getUserId(HttpServletRequest request) throws PortalAPIException {
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <!-- OParent provides audits, distribution management, etc. -->
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>0.1.1</version>
+ <relativePath />
+ </parent>
+
<!-- Portal SDK Maven parent project -->
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
<name>portal-sdk</name>
<url>https://wiki.onap.org/display/DW/Portal</url>
- <!-- OParent provides license audit, code audit, distribution management,
- etc.
- But jenkins build fails, so comment out for now.
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>0.1.0</version>
- </parent>
- -->
-
<modules>
<module>epsdk-fw</module>
<module>epsdk-core</module>
<springframework.version>4.2.0.RELEASE</springframework.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<skiptests>true</skiptests>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
- <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
- <stagingNexusPath>content/repositories/staging/</stagingNexusPath>
- <releaseNexusPath>content/repositories/releases/</releaseNexusPath>
</properties>
- <repositories>
- <repository>
- <id>releases</id>
- <name>ONAP - Release Repository</name>
- <url>${nexusproxy}/${releaseNexusPath}</url>
- </repository>
- <repository>
- <id>staging</id>
- <name>ONAP - Staging Repository</name>
- <url>${nexusproxy}/${stagingNexusPath}</url>
- </repository>
- <repository>
- <id>snapshots</id>
- <name>ONAP - Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
- </repository>
- <repository>
- <id>public</id>
- <name>ONAP public Repository</name>
- <url>${nexusproxy}/content/groups/public</url>
- </repository>
- </repositories>
+ <!-- Specify the repositories here to avoid coordination of ~/.m2/settings.xml
+ files among all developers. Also use values (not properties) so oparent can
+ be resolved. -->
+ <repositories>
+ <repository>
+ <id>onap-releases</id>
+ <name>ONAP - Release Repository</name>
+ <url>https://nexus.onap.org/content/repositories/releases</url>
+ </repository>
+ <repository>
+ <id>onap-staging</id>
+ <name>ONAP - Staging Repository</name>
+ <url>https://nexus.onap.org/content/repositories/staging</url>
+ </repository>
+ <repository>
+ <id>onap-snapshots</id>
+ <name>ONAP - Snapshot Repository</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots</url>
+ </repository>
+ <repository>
+ <id>onap-public</id>
+ <url>https://nexus.onap.org/content/groups/public</url>
+ </repository>
+ </repositories>
+
+ <!-- Specify the repositories here to avoid coordination of ~/.m2/settings.xml
+ files among all developers. -->
+ <pluginRepositories>
+ <pluginRepository>
+ <id>onap-plugin-release</id>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>onap-plugin-staging</id>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>onap-plugin-snapshots</id>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ </pluginRepository>
+ </pluginRepositories>
<profiles>
<!-- disable doclint, a new feature in Java 8, when generating javadoc -->
</build>
<distributionManagement>
- <!-- The id below must match .m2/settings.xml/servers/server/id -->
+ <!-- Override the OParent sections which use id "ecomp-releases" etc.
+ The ids below must match .m2/settings.xml/servers/server/id -->
<repository>
<id>releases</id>
<name>OpenECOMP - Release Repository</name>
<!-- Javadocs -->
<site>
<id>ecomp-site</id>
- <url>dav:${nexusproxy}${sitePath}</url>
+ <url>dav:https://nexus.onap.org/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</url>
</site>
</distributionManagement>