You will have to invoke the upload using httpclient APIs in Java.Also, for authentication, you can use token based authentication - https://experienceleague.adobe.com/en/docs/experience-manager-learn/getting-started-with-aem-headless/authentication/overview