aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/dcae/common/ConfigProcessors.java11
-rw-r--r--src/main/java/org/onap/dcae/restapi/ApiAuthInterceptor.java13
2 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/org/onap/dcae/common/ConfigProcessors.java b/src/main/java/org/onap/dcae/common/ConfigProcessors.java
index d1c5e5a0..040a3e6e 100644
--- a/src/main/java/org/onap/dcae/common/ConfigProcessors.java
+++ b/src/main/java/org/onap/dcae/common/ConfigProcessors.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * Copyright (C) 2017,2023 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +71,7 @@ public class ConfigProcessors {
}
- private String evaluate(String str) {
+ String evaluate(String str) {
String value = str;
if (str.startsWith("$")) {
value = (String) getEventObjectVal(str.substring(1));
@@ -134,7 +133,7 @@ public class ConfigProcessors {
}
- private void renameArrayInArray(JSONObject jsonObject) // map
+ void renameArrayInArray(JSONObject jsonObject) // map
{
log.info("renameArrayInArray");
final String field = jsonObject.getString(FIELD);
@@ -437,7 +436,7 @@ public class ConfigProcessors {
}
- private boolean checkFilter(JSONObject jo, String key, String logicKey) {
+ boolean checkFilter(JSONObject jo, String key, String logicKey) {
String filterValue = jo.getString(key);
if (filterValue.contains(":")) {
String[] splitVal = filterValue.split(":");
@@ -455,7 +454,7 @@ public class ConfigProcessors {
}
}
- if ("contains".equals(splitVal[0])) {
+ if ("contains".equals(splitVal[0])) {
if ("not".equals(logicKey)) {
if (getEventObjectVal(key).toString().contains(splitVal[1])) {
log.info(filterValue + "==" + key + "==" + getEventObjectVal(key) + COMP_FALSE);
diff --git a/src/main/java/org/onap/dcae/restapi/ApiAuthInterceptor.java b/src/main/java/org/onap/dcae/restapi/ApiAuthInterceptor.java
index 8c5fb82a..a9f309a3 100644
--- a/src/main/java/org/onap/dcae/restapi/ApiAuthInterceptor.java
+++ b/src/main/java/org/onap/dcae/restapi/ApiAuthInterceptor.java
@@ -3,6 +3,7 @@
* org.onap.dcaegen2.collectors.ves
* ================================================================================
* Copyright (C) 2018 - 2019 Nokia. All rights reserved.
+ * Copyright (C) 2023 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,18 +116,18 @@ public class ApiAuthInterceptor extends HandlerInterceptorAdapter {
return false;
}
- private boolean isBasicAuth() {
+ boolean isBasicAuth() {
return settings.authMethod().equalsIgnoreCase(AuthMethodType.CERT_BASIC_AUTH.value());
}
- private boolean isAuthorized(String authorizationHeader) {
+ boolean isAuthorized(String authorizationHeader) {
try {
String decodeCredentials = decodeCredentials(authorizationHeader);
String providedUser = extractUser(decodeCredentials);
String providedPassword = extractPassword(decodeCredentials);
Option<String> maybeSavedPassword = settings.validAuthorizationCredentials().get(providedUser);
boolean userRegistered = maybeSavedPassword.isDefined();
- return userRegistered && cryptPassword.matches(providedPassword,maybeSavedPassword.get());
+ return userRegistered && verifyCryptPassword(providedPassword,maybeSavedPassword);
} catch (Exception e) {
LOG.warn(String.format("Could not check if user is authorized (header: '%s')), probably malformed header.",
authorizationHeader), e);
@@ -134,6 +135,10 @@ public class ApiAuthInterceptor extends HandlerInterceptorAdapter {
}
}
+ Boolean verifyCryptPassword(String providedPassword, Option<String> maybeSavedPassword) {
+ return cryptPassword.matches(providedPassword,maybeSavedPassword.get());
+ }
+
private String extractPassword(String decodeCredentials) {
return decodeCredentials.split(":")[1].trim();
}
@@ -146,4 +151,4 @@ public class ApiAuthInterceptor extends HandlerInterceptorAdapter {
String encodedData = authorizationHeader.split(" ")[1];
return new String(Base64.getDecoder().decode(encodedData));
}
-} \ No newline at end of file
+}