aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java')
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java44
1 files changed, 33 insertions, 11 deletions
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
index 77fdb11..bcd9ca1 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
@@ -1,27 +1,27 @@
/*
* Copyright © 2017-2019 AT&T Intellectual Property.
* Modifications Copyright © 2018 IBM.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file 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.
@@ -41,28 +41,44 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+/**
+ * The Class PropertiesManagement.
+ */
@Component
public class PropertiesManagement {
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
- private final static String algorithm = "AES";
- private final static String cipherMode = "CBC";
- private final static String paddingScheme = "PKCS5Padding";
- private final static String transformation = algorithm + "/" + cipherMode + "/" + paddingScheme;
+ private static final String algorithm = "AES";
+ private static final String cipherMode = "CBC";
+ private static final String paddingScheme = "PKCS5Padding";
+ private static final String transformation = algorithm + "/" + cipherMode + "/" + paddingScheme;
private static final String initVector = "ONAPCMSOVECTORIV"; // 16 bytes IV
@Autowired
Environment env;
+ /**
+ * Gets the property.
+ *
+ * @param key the key
+ * @param defaultValue the default value
+ * @return the property
+ */
public String getProperty(String key, String defaultValue) {
String value = env.getProperty(key, defaultValue);
value = getDecryptedValue(value);
return value;
}
+ /**
+ * Gets the decrypted value.
+ *
+ * @param value the value
+ * @return the decrypted value
+ */
public static String getDecryptedValue(String value) {
if (value.startsWith("enc:")) {
String secret = getSecret();
@@ -71,6 +87,12 @@ public class PropertiesManagement {
return value;
}
+ /**
+ * Gets the encrypted value.
+ *
+ * @param value the value
+ * @return the encrypted value
+ */
public static String getEncryptedValue(String value) {
String secret = getSecret();
value = encrypt(secret, initVector, value);