-1

There is a java application which uses REST. The application is used to upload a file to ftp. The file that is being uploaded has an ID called recordID and it is seen through URL because of QueryParam. I need to send the ftp login credentials along with the uploaded file recordID in the URL. I thought QueryParam would help. Can anyone please help me how do i use QueryParam to send Username and Password of ftp via URL to authenticate?

Thanks in advance.

vardhan
  • 53
  • 7
  • Never pass credentials in query parameters because they're not handled as private information. – chrylis -cautiouslyoptimistic- Nov 01 '17 at 05:52
  • Hi. Thanks for the reply. But I was asked to see a way to dynamically pass ftp credentials instead of hardcoding them in our java application. So i came up with queryparam. Is there any other way to send the ftp credentials dynamically along with the uploading file? If so, please share some references and examples. – vardhan Nov 01 '17 at 06:05
  • Do they change with each request? If so, use POST parameters. If not, use environment variables to configure your Java application. – chrylis -cautiouslyoptimistic- Nov 01 '17 at 06:24
  • No, they do not change. The username and password for the ftp are same so they were hardcoded in the java program to connect. May i know the complete details on how we can use environment variables in this case? Thanks. – vardhan Nov 01 '17 at 06:29

1 Answers1

-1

Hi it's not a good practice to send u're user name and the password as a query param in url for authentication purpose.It must be a post request which sends u're credentials to the server.

Else if u're still in to this u have to modify u're servers file uploading function to allow another to parameter on user name and password.Normally these are handled in Spring,SpringBoot with @RequestParam in the parameter section of the method