I have a code in php for access to the bank hosted on a Linux machine, I use the credentials to access it through the terminal. Normally I would have to use:
java.net.URL url = new URL(URL);
HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
However, when entering the terminal, using ssh, I need credentials. How do I specify these credentials in the code?
I found a topic here in the forum with this answer, but it was for authentication on a server:
String userCredentials = "username:password";
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userCredentials.getBytes()));
httpURLConnection.setRequestProperty("Authorization", basicAuth);
For connection to the terminal, it asks me for two ssh authentication.
How would this be done in the code? Or do you have another way to do it?