List of usage examples for org.apache.commons.vfs UserAuthenticator requestAuthentication
public UserAuthenticationData requestAuthentication(UserAuthenticationData.Type[] types);
From source file:org.pentaho.s3.vfs.S3FileSystem.java
public S3Service getS3Service() { if (service == null || service.getProviderCredentials() == null || service.getProviderCredentials().getAccessKey() == null) { UserAuthenticator userAuthenticator = DefaultFileSystemConfigBuilder.getInstance() .getUserAuthenticator(getFileSystemOptions()); String awsAccessKey = null; String awsSecretKey = null; if (userAuthenticator != null) { UserAuthenticationData data = userAuthenticator .requestAuthentication(S3FileProvider.AUTHENTICATOR_TYPES); awsAccessKey = String.valueOf(data.getData(UserAuthenticationData.USERNAME)); awsSecretKey = String.valueOf(data.getData(UserAuthenticationData.PASSWORD)); } else {/*from w w w . j a v a 2 s . com*/ awsAccessKey = ((URLFileName) getRootName()).getUserName(); awsSecretKey = ((URLFileName) getRootName()).getPassword(); } ProviderCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey); try { service = new RestS3Service(awsCredentials); } catch (Throwable t) { System.out.println("Could not getS3Service() for " + awsCredentials.getLogString()); t.printStackTrace(); } } return service; }