force the use of FTPS to upload, note that it requires openJDK
This commit is contained in:
parent
67b4e9b81e
commit
feece4b804
|
@ -0,0 +1,25 @@
|
|||
|
||||
# Changelog for social-dockbar-hook
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v7.0.0] - 2020-10-01
|
||||
|
||||
ported to git and added patch for my account URL pointing to keycloak user acount URL
|
||||
|
||||
## [v0.3.0] - 2013-05-29
|
||||
|
||||
Extended support for Notifications
|
||||
|
||||
Added New Notification Types
|
||||
|
||||
## [v0.3.0] - 2013-04-19
|
||||
|
||||
Extended support for Notifications
|
||||
|
||||
Added New Notification Types
|
||||
|
||||
## [v0.1.0] - 2013-02-17
|
||||
|
||||
First release
|
|
@ -0,0 +1,26 @@
|
|||
# Acknowledgments
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
|
||||
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
|
||||
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
|
||||
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
|
||||
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
|
||||
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
|
||||
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
|
||||
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
|
||||
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
|
||||
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
|
||||
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
|
||||
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
|
||||
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
|
||||
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
|
||||
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
|
||||
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
|
||||
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);
|
4
pom.xml
4
pom.xml
|
@ -11,7 +11,7 @@
|
|||
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.8.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Social Portal ASL Extension</name>
|
||||
<description>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>3.6.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -6,15 +6,17 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
|||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.net.PrintCommandListener;
|
||||
import org.apache.commons.net.ftp.FTP;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPSClient;
|
||||
import org.gcube.applicationsupportlayer.social.ScopeBeanExt;
|
||||
import org.gcube.common.encryption.StringEncrypter;
|
||||
import org.gcube.common.encryption.encrypter.StringEncrypter;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
@ -65,7 +67,7 @@ public class FTPManager {
|
|||
* @return the http url of the image uploaded on the ftp server
|
||||
*/
|
||||
public String uploadImageOnFTPServer(InputStream previewThumbnailInputStream, ImageType imageExtension) {
|
||||
FTPClient client = new FTPClient( );
|
||||
FTPSClient client = new FTPSClient(false);
|
||||
InputStream inputStream = previewThumbnailInputStream;
|
||||
|
||||
String ftpUrl = "";
|
||||
|
@ -79,23 +81,23 @@ public class FTPManager {
|
|||
ftpUrl = ac.address();
|
||||
httpBaseURL = res.profile().runtime().hostedOn();
|
||||
user = ac.username();
|
||||
|
||||
|
||||
//set the scope
|
||||
//set the context
|
||||
String currScope = ScopeProvider.instance.get();
|
||||
ScopeBeanExt sbe = new ScopeBeanExt(context);
|
||||
String scopeToQuery = sbe.getInfrastructureScope();
|
||||
ScopeProvider.instance.set(scopeToQuery);
|
||||
pwd = StringEncrypter.getEncrypter().decrypt(ac.password());
|
||||
ScopeProvider.instance.set(currScope);
|
||||
|
||||
// Connect to the FTP server
|
||||
client.connect(ftpUrl);
|
||||
_log.debug("FTPS host="+ftpUrl);
|
||||
client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
|
||||
client.connect(ftpUrl, 21);
|
||||
client.execAUTH("TLS"); //SSL
|
||||
_log.debug("FTPs Connect reply code="+client.getReplyCode());
|
||||
client.login(user, pwd);
|
||||
|
||||
client.execPBSZ(0);
|
||||
client.execPROT("P");
|
||||
client.setFileType(FTP.BINARY_FILE_TYPE);
|
||||
client.enterLocalPassiveMode();
|
||||
|
||||
BufferedInputStream bis = new BufferedInputStream(inputStream);
|
||||
client.storeFile(fileName, bis);
|
||||
bis.close();
|
||||
|
|
Loading…
Reference in New Issue