Skip to content

Commit abb9fe6

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 3ca79dc commit abb9fe6

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;
@@ -264,10 +265,11 @@ protected S3CredentialsStrategy configureCredentialsStrategy(final HttpClientBui
264265
}
265266
if(S3Session.isAwsHostname(host.getHostname())) {
266267
// Try auto-configure
267-
if(Scheme.isURL(host.getProtocol().getContext())) {
268-
log.debug("Auto-configure credentials from instance metadata {}", host.getProtocol().getContext());
268+
final String context = preferences.getProperty(Profile.CONTEXT_KEY);
269+
if(Scheme.isURL(context)) {
270+
log.debug("Auto-configure credentials from HTTP endpoint {}", context);
269271
// Fetch temporary session token from instance metadata
270-
return new AWSSessionCredentialsRetriever(trust, key, host.getProtocol().getContext());
272+
return new AWSSessionCredentialsRetriever(trust, key, context);
271273
}
272274
}
273275
if(host.getProtocol().isRoleConfigurable()) {

0 commit comments

Comments
 (0)