Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/src/main/java/ch/cyberduck/core/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ public Map<String, String> getProperties() {
property -> StringUtils.contains(property, '=') ? substitutor.replace(StringUtils.substringAfter(property, '=')) : StringUtils.EMPTY)));
// In profile as dict
properties.putAll(this.map(PROPERTIES_KEY));
if(null != this.getContext()) {
properties.put(CONTEXT_KEY, this.getContext());
}
return properties;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Credentials get() throws BackgroundException {
final HttpClientBuilder configuration = builder.build(ProxyFactory.get(),
new DisabledTranscriptListener(), new DisabledLoginCallback());
try (CloseableHttpClient client = configuration.build()) {
final HttpRequestBase resource = new HttpGet(new HostUrlProvider().withUsername(false).withPath(true).get(address));
final HttpRequestBase resource = new HttpGet(url);
return client.execute(resource, response -> {
switch(response.getStatusLine().getStatusCode()) {
case HttpStatus.SC_OK:
Expand Down
8 changes: 5 additions & 3 deletions s3/src/main/java/ch/cyberduck/core/s3/S3Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import ch.cyberduck.core.LoginCallback;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.PathContainerService;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.TemporaryAccessTokens;
import ch.cyberduck.core.UrlProvider;
Expand Down Expand Up @@ -268,10 +269,11 @@ protected S3CredentialsStrategy configureCredentialsStrategy(final HttpClientBui
}
if(S3Session.isAwsHostname(host.getHostname())) {
// Try auto-configure
if(Scheme.isURL(host.getProtocol().getContext())) {
log.debug("Auto-configure credentials from instance metadata {}", host.getProtocol().getContext());
final String context = preferences.getProperty(Profile.CONTEXT_KEY);
if(Scheme.isURL(context)) {
log.debug("Auto-configure credentials from HTTP endpoint {}", context);
// Fetch temporary session token from instance metadata
return new AWSSessionCredentialsRetriever(trust, key, host.getProtocol().getContext());
return new AWSSessionCredentialsRetriever(trust, key, context);
}
}
if(host.getProtocol().isRoleConfigurable()) {
Expand Down