Fix bug 'X-Frame-Options not configured: Lack of clickjacking protection'
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / fe / config / Configuration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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 package org.openecomp.sdc.fe.config;
21
22 import static java.lang.String.format;
23
24 import java.util.Date;
25 import java.util.List;
26 import lombok.Getter;
27 import lombok.NoArgsConstructor;
28 import lombok.Setter;
29 import org.openecomp.sdc.common.api.BasicConfiguration;
30
31 @Getter
32 @Setter
33 @NoArgsConstructor
34 public class Configuration extends BasicConfiguration {
35
36     /**
37      * fe FQDN
38      */
39     private String feFqdn;
40     /**
41      * backend host
42      */
43     private String beHost;
44     /**
45      * backend http port
46      */
47     private Integer beHttpPort;
48     /**
49      * backend http secured port
50      */
51     private Integer beSslPort;
52     private Integer healthCheckSocketTimeoutInMs;
53     private Integer healthCheckIntervalInSeconds;
54     private List<String> healthStatusExclude;
55     private FeMonitoringConfig systemMonitoring;
56     private String onboardingForwardContext;
57     private OnboardingConfig onboarding;
58     private CookieConfig authCookie;
59     private BasicAuthConfig basicAuth;
60     private CatalogFacadeMsConfig catalogFacadeMs;
61     /**
62      * be http context
63      */
64     private String beContext;
65     /**
66      * backend protocol. http | https
67      */
68     private String beProtocol = "http";
69     private Date released;
70     private String version = "1111";
71     private Connection connection;
72     private List<String> protocols;
73     private int threadpoolSize;
74     private int requestTimeout;
75     private List<List<String>> identificationHeaderFields;
76     private List<List<String>> optionalHeaderFields;
77     private List<String> forwardHeaderFields;
78     private String permittedAncestors; // Space separated list of permitted ancestors
79
80     public Integer getHealthCheckSocketTimeoutInMs(int defaultVal) {
81         return healthCheckSocketTimeoutInMs == null ? defaultVal : healthCheckSocketTimeoutInMs;
82     }
83
84     public Integer getHealthCheckIntervalInSeconds(int defaultVal) {
85         return healthCheckIntervalInSeconds == null ? defaultVal : healthCheckIntervalInSeconds;
86     }
87
88     @Override
89     public String toString() {
90         return new StringBuilder().append(format("backend host: %s%n", beHost)).append(format("backend http port: %s%n", beHttpPort))
91             .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext))
92             .append(format("backend protocol: %s%n", beProtocol)).append(format("onboarding forward context: %s%n", onboardingForwardContext))
93             .append(format("Version: %s%n", version)).append(format("Released: %s%n", released))
94             .append(format("Connecting to database: %s%n", connection)).append(format("Supported protocols: %s%n", protocols)).toString();
95     }
96
97     @Getter
98     @Setter
99     @NoArgsConstructor
100     public static class FeMonitoringConfig {
101
102         private Boolean enabled;
103         private Boolean isProxy;
104         private Integer probeIntervalInSeconds;
105
106         public Integer getProbeIntervalInSeconds(int defaultVal) {
107             return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
108         }
109     }
110
111     @Getter
112     @Setter
113     @NoArgsConstructor
114     public static class OnboardingConfig {
115
116         private String protocolFe = "http";
117         private String hostFe;
118         private Integer portFe;
119         private String protocolBe = "http";
120         private String hostBe;
121         private Integer portBe;
122         private String healthCheckUriFe;
123     }
124
125     @Getter
126     @Setter
127     @NoArgsConstructor
128     public static class CookieConfig {
129
130         private String cookieName = "AuthenticationCookie";
131         private String path = "";
132         private String domain = "";
133         private String securityKey = "";
134     }
135
136     @Getter
137     @Setter
138     @NoArgsConstructor
139     public static class BasicAuthConfig {
140
141         private boolean enabled = false;
142         private String userName = "";
143         private String userPass = "";
144     }
145
146     @Getter
147     @Setter
148     @NoArgsConstructor
149     public static class CatalogFacadeMsConfig {
150
151         private String protocol;
152         private String host;
153         private Integer port;
154         private String healthCheckUri;
155         private String path;
156     }
157 }