Added new class functionality

This commit is contained in:
Keith Armstrong 2025-01-06 20:30:13 -05:00
parent 545b6d03d8
commit f0a05d8ae2
3 changed files with 41 additions and 18 deletions

View File

@ -48,12 +48,12 @@ public class soapProcessor {
URLConnection connection = url.openConnection();
if (thisCredentials != null)
{
debugProcessor.writer(false, "We are using credentials!");
debugProcessor.writer(false, "Passing Username and Password to this service!");
connection.setRequestProperty("Authorization", "Basic " + thisCredentials);
}
else
{
debugProcessor.writer(false, "No credentials will be used!");
debugProcessor.writer(false, "This service does not require a login!");
}
HttpURLConnection httpConn = (HttpURLConnection)connection;
return httpConn;

View File

@ -16,7 +16,7 @@ public class userVerify
Scanner myObj = new Scanner(System.in); // Create a Scanner object
debugProcessor.writer(false, "");
debugProcessor.writer(true, "SOAP Client (03.01.2025 build) - Belkast Consulting (c) 2025");
debugProcessor.writer(true, "SOAP Client (06.01.2025 build) - Belkast Consulting (c) 2025");
debugProcessor.writer(true, "");
String varPrompt = "Please enter the name of the CSV file to validate : ";
String varFileName;
@ -30,17 +30,15 @@ public class userVerify
{
break;
}
varPrompt = "\nEither the CSV file does not exist or the CSV file cannot be read!\nPlease enter the name of the CSV file to validate : ";
varPrompt = "\nThe CSV file does not exist or cannot be read!\nPlease enter the name of the CSV file to validate : ";
}
Boolean varUserBlockEmpty = false;
HashMap<String, Boolean> valueMap = new HashMap();
valueMap.put("", true);
valueMap.put("Y", true);
valueMap.put("y", true);
valueMap.put("N", false);
valueMap.put("n", false);
valueMap.put("", true);
while (true)
{

View File

@ -20,7 +20,7 @@ public class webService {
public static void main(String... argv) throws Exception
{
debugProcessor.writer(true, "");
debugProcessor.writer(true, "SOAP Client (03.01.2025 build) - Belkast Consulting (c) 2025");
debugProcessor.writer(true, "SOAP Client (06.01.2025 build) - Belkast Consulting (c) 2025");
debugProcessor.writer(true, "");
// @Parameter(names = "--props",
@ -94,8 +94,6 @@ public class webService {
debugProcessor.writer(false, "Debug is set to : " + varDebug);
String varURL = propertyProcessor.getProperty(thisProps, "SHIM_URL");
String varUsername = propertyProcessor.getProperty(thisProps, "USERNAME");
String varPasswordTemp = propertyProcessor.getProperty(thisProps, "PASSWORD");
String varUseSSL = propertyProcessor.getProperty(thisProps, "SSL");
String varKeystore_LOC = propertyProcessor.getProperty(thisProps, "JAVA_KS_LOCATION");
@ -129,18 +127,35 @@ public class webService {
System.exit(0);
}
try {
varPassword = salter.decrypt(varPasswordTemp, varKey, varSalt);
} catch (Exception e) {
debugProcessor.writer(true, "The password could not be decrypted. Please check that the Encryption Key is correct!");
System.out.println();
System.exit(0);
String varAuthProp = propertyProcessor.getProperty(thisProps, "AUTH_REQUIRED");
Boolean varAuthRequired = Boolean.valueOf(varAuthProp);
String varUsername = propertyProcessor.getProperty(thisProps, "USERNAME");
if (varAuthRequired && varUsername == null)
{
varUsername = userCreds.getUsername();
}
String varPasswordTemp = propertyProcessor.getProperty(thisProps, "PASSWORD");
if (varAuthRequired && varPasswordTemp == null)
{
char[] varUserPW = userCreds.getPassword();
varPasswordTemp = salter.encrypt(String.copyValueOf(varUserPW), varKey, varSalt);
}
try
{
varPassword = salter.decrypt(varPasswordTemp, varKey, varSalt);
}
catch(Exception e)
{
debugProcessor.writer(true, "The password could not be decrypted. Please check that the Encryption Key is correct!");
System.out.println();
System.exit(0);
}
debugProcessor.writer(varDebug, "");
debugProcessor.writer(varDebug, thisProps + " => SOAP URL : " + varURL);
debugProcessor.writer(varDebug, thisProps + " => Username : " + varUsername);
debugProcessor.writer(varDebug, thisProps + " => Authentication required : " + varAuthRequired);
debugProcessor.writer(varDebug, thisProps + " => Use SSL : " + varUseSSL);
debugProcessor.writer(varDebug, thisProps + " => JAVA keystore : " + varKeystore_LOC);
debugProcessor.writer(varDebug, thisProps + " => JAVA keystore password : " + varKeystore_PW);
@ -148,6 +163,16 @@ public class webService {
debugProcessor.writer(varDebug, thisProps + " => CSV file : " + varRoleFile);
debugProcessor.writer(varDebug, thisProps + " => CSV allow empty : " + varEmptyColumns);
if (!varAuthRequired)
{
varUsername = null;
varPassword = null;
}
else
{
debugProcessor.writer(varDebug, thisProps + " => Username : " + varUsername);
}
ArrayList thisCSV = userVerify.readCSV(varRoleFile, false, !varEmptyColumns);
boolean validfile = (!thisCSV.isEmpty());