I am developing a microservice, that implements a REST API. It is to take certain files form a shared network location and upload them to an FTP server.
Here is a sample code:
@RequestMapping(method = RequestMethod.GET, value = "/ftpProcess", produces = "text/plain")
public String ftpFiles() throws UnknownHostException {
String status = "" ;
JSch jsch = new JSch();
Session session = null;
try {
session = jsch.getSession("ftpUserName", "ftpHost", 10022);
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword("ftpPassword");
session.connect();
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp sftpChannel = (ChannelSftp) channel;
//Just an example - I wull upload 4 dummy files
for(int i=1; i<4; i++) {
sftpChannel.put(/*Here I navigate to a file, and repeat it 3 times for 3 different files*/);
}
sftpChannel.exit();
session.disconnect();
status = "SUCCSSES" ;
}
In a real application I may have a different ftpServer/host, user and password, so they have to come in as parameters. I know I can do it either with @PathVariable or @parameters - to do it via HTTP GET, but this way everyone will see what gets passed.
How can i pass the input information, so that it remains secret?