Skip to content

Commit 51a3542

Browse files
dkochersannies
andcommitted
Expose Context key in profile as property and allow override in bookmark.
Co-authored-by: Sebastian Annies <[email protected]>
1 parent ad50c4e commit 51a3542

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

core/src/main/java/ch/cyberduck/core/Profile.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ public Map<String, String> getProperties() {
685685
property -> StringUtils.contains(property, '=') ? substitutor.replace(StringUtils.substringAfter(property, '=')) : StringUtils.EMPTY)));
686686
// In profile as dict
687687
properties.putAll(this.map(PROPERTIES_KEY));
688+
if(null != this.getContext()) {
689+
properties.put(CONTEXT_KEY, this.getContext());
690+
}
688691
return properties;
689692
}
690693

s3/src/main/java/ch/cyberduck/core/s3/S3Session.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import ch.cyberduck.core.LoginCallback;
2828
import ch.cyberduck.core.Path;
2929
import ch.cyberduck.core.PathContainerService;
30+
import ch.cyberduck.core.Profile;
3031
import ch.cyberduck.core.Scheme;
3132
import ch.cyberduck.core.TemporaryAccessTokens;
3233
import ch.cyberduck.core.UrlProvider;
@@ -268,10 +269,11 @@ protected S3CredentialsStrategy configureCredentialsStrategy(final HttpClientBui
268269
}
269270
if(S3Session.isAwsHostname(host.getHostname())) {
270271
// Try auto-configure
271-
if(Scheme.isURL(host.getProtocol().getContext())) {
272-
log.debug("Auto-configure credentials from instance metadata {}", host.getProtocol().getContext());
272+
final String context = preferences.getProperty(Profile.CONTEXT_KEY);
273+
if(Scheme.isURL(context)) {
274+
log.debug("Auto-configure credentials from HTTP endpoint {}", context);
273275
// Fetch temporary session token from instance metadata
274-
return new AWSSessionCredentialsRetriever(trust, key, host.getProtocol().getContext());
276+
return new AWSSessionCredentialsRetriever(trust, key, context);
275277
}
276278
}
277279
if(host.getProtocol().isRoleConfigurable()) {

0 commit comments

Comments
 (0)