From adfeef1d044431dfa54d0720dc83f006729bf2b1 Mon Sep 17 00:00:00 2001 From: psainics Date: Mon, 6 Jan 2025 11:55:52 +0530 Subject: [PATCH] Refactor validateBasicCredentials --- .../connector/SuccessFactorsConnectorConfig.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/cdap/plugin/successfactors/connector/SuccessFactorsConnectorConfig.java b/src/main/java/io/cdap/plugin/successfactors/connector/SuccessFactorsConnectorConfig.java index c86417e..6917233 100644 --- a/src/main/java/io/cdap/plugin/successfactors/connector/SuccessFactorsConnectorConfig.java +++ b/src/main/java/io/cdap/plugin/successfactors/connector/SuccessFactorsConnectorConfig.java @@ -250,7 +250,7 @@ public String getBaseURL() { public void validateBasicCredentials(FailureCollector failureCollector) { - if (BASIC_AUTH.equals(authType)) { + if (BASIC_AUTH.equals(this.getAuthType())) { if (Strings.isNullOrEmpty(getUsername()) && !containsMacro(UNAME)) { String errMsg = ResourceConstants.ERR_MISSING_PARAM_PREFIX.getMsgForKey(SAP_SUCCESSFACTORS_USERNAME); failureCollector.addFailure(errMsg, COMMON_ACTION).withConfigProperty(UNAME); @@ -259,9 +259,7 @@ public void validateBasicCredentials(FailureCollector failureCollector) { String errMsg = ResourceConstants.ERR_MISSING_PARAM_PREFIX.getMsgForKey(SAP_SUCCESSFACTORS_PASSWORD); failureCollector.addFailure(errMsg, COMMON_ACTION).withConfigProperty(PASSWORD); } - - } - if (OAUTH2.equals(authType)) { + } else { if (Strings.isNullOrEmpty(getClientId()) && !containsMacro(CLIENT_ID)) { String errMsg = ResourceConstants.ERR_MISSING_PARAM_PREFIX.getMsgForKey(CLIENT_ID); failureCollector.addFailure(errMsg, COMMON_ACTION).withConfigProperty(CLIENT_ID); @@ -279,7 +277,6 @@ public void validateBasicCredentials(FailureCollector failureCollector) { failureCollector.addFailure(errMsg, COMMON_ACTION).withConfigProperty(TOKEN_URL); } - if (ENTER_TOKEN.equals(assertionTokenType)) { if (Strings.isNullOrEmpty(getAssertionToken()) && !containsMacro(ASSERTION_TOKEN)) { String errMsg = ResourceConstants.ERR_MISSING_PARAM_PREFIX.getMsgForKey(ASSERTION_TOKEN);