Catalog alignment
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / filters / PortalConfiguration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.filters;
22
23 import com.google.common.annotations.VisibleForTesting;
24 import org.apache.commons.lang.StringUtils;
25 import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
26 import org.onap.sdc.security.IPortalConfiguration;
27 import org.onap.sdc.security.PortalClient;
28
29 import java.security.InvalidParameterException;
30
31 public class PortalConfiguration implements IPortalConfiguration {
32     private static final String PROPERTY_NOT_SET = "%s property value is not set in portal.properties file";
33     private String portalUser;
34     private String portalPassword;
35     private String ecompPortalRestURL;
36     private String portalAppName;
37     private String uebKey;
38
39     public PortalConfiguration() throws org.onap.portalsdk.core.onboarding.exception.CipherUtilException {
40         this.portalUser = org.onap.portalsdk.core.onboarding.util.PortalApiProperties.getProperty(org.onap.sdc.security.PortalClient.PortalPropertiesEnum.USER.value());
41         this.portalPassword = org.onap.portalsdk.core.onboarding.util.PortalApiProperties.getProperty(PortalClient.PortalPropertiesEnum.PASSWORD.value());
42         this.portalAppName = org.onap.portalsdk.core.onboarding.util.PortalApiProperties.getProperty(PortalClient.PortalPropertiesEnum.APP_NAME.value());
43         this.ecompPortalRestURL = org.onap.portalsdk.core.onboarding.util.PortalApiProperties.getProperty(org.onap.sdc.security.PortalClient.PortalPropertiesEnum.ECOMP_REST_URL.value());
44         this.uebKey = org.onap.portalsdk.core.onboarding.util.PortalApiProperties.getProperty(org.onap.sdc.security.PortalClient.PortalPropertiesEnum.UEB_APP_KEY.value());
45     }
46
47     @VisibleForTesting
48     String getPortalProperty(String key) {
49         String value = PortalApiProperties.getProperty(key);
50         if (StringUtils.isEmpty(value)) {
51             throw new InvalidParameterException(String.format(PROPERTY_NOT_SET, key));
52         }
53         return value;
54     }
55
56     @Override
57     public String getPortalApiPrefix() {
58         return null;
59     }
60
61     @Override
62     public long getMaxIdleTime() {
63         return 0;
64     }
65
66     @Override
67     public String getUserAttributeName() {
68         return null;
69     }
70
71     @Override
72     public boolean IsUseRestForFunctionalMenu() {
73         return false;
74     }
75
76     @Override
77     public String getPortalApiImplClass() {
78         return null;
79     }
80
81     @Override
82     public String getRoleAccessCentralized() {
83         return null;
84     }
85
86     @Override
87     public boolean getUebListenersEnable() {
88         return false;
89     }
90
91     @Override
92     public String getEcompRedirectUrl() {
93         return null;
94     }
95
96     @Override
97     public String getEcompRestUrl() {
98         return ecompPortalRestURL;
99     }
100
101     @Override
102     public String getPortalUser() {
103         return portalUser;
104     }
105
106     @Override
107     public String getPortalPass() {
108         return portalPassword;
109     }
110
111     @Override
112     public String getPortalAppName() {
113         return portalAppName;
114     }
115
116     @Override
117     public String getUebAppKey() {
118         return uebKey;
119     }
120
121     @Override
122     public String getAafNamespace() {
123         return null;
124     }
125
126     @Override
127     public String getAuthNamespace() {
128         return null;
129     }
130
131     @Override
132     public String getCspCookieName() {
133         return null;
134     }
135
136     @Override
137     public String getCspGateKeeperProdKey() {
138         return null;
139     }
140
141     @Override
142     public String getExtReqConnectionTimeout() {
143         return null;
144     }
145
146     @Override
147     public String getExtReqReadTimeout() {
148         return null;
149     }
150 }