Skip to content

Commit 03ed998

Browse files
committed
Log a warning in case of missing sts dependency.
Fixes aws#1915.
1 parent 668e773 commit 03ed998

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/auth/src/main/java/software/amazon/awssdk/auth/credentials/internal/WebIdentityCredentialsUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import software.amazon.awssdk.annotations.SdkInternalApi;
2020
import software.amazon.awssdk.auth.credentials.WebIdentityTokenCredentialsProviderFactory;
2121
import software.amazon.awssdk.core.internal.util.ClassLoaderHelper;
22+
import software.amazon.awssdk.utils.Logger;
2223

2324
/**
2425
* Utility class used to configure credential providers based on JWT web identity tokens.
2526
*/
2627
@SdkInternalApi
2728
public final class WebIdentityCredentialsUtils {
29+
private static final Logger log = Logger.loggerFor(WebIdentityCredentialsUtils.class);
2830

2931
private static final String STS_WEB_IDENTITY_CREDENTIALS_PROVIDER_FACTORY =
3032
"software.amazon.awssdk.services.sts.internal.StsWebIdentityCredentialsProviderFactory";
@@ -44,7 +46,9 @@ public static WebIdentityTokenCredentialsProviderFactory factory() {
4446
WebIdentityCredentialsUtils.class);
4547
return (WebIdentityTokenCredentialsProviderFactory) stsCredentialsProviderFactory.getConstructor().newInstance();
4648
} catch (ClassNotFoundException e) {
47-
throw new IllegalStateException("To use web identity tokens, the 'sts' service module must be on the class path.", e);
49+
String message = "To use web identity tokens, the 'sts' service module must be on the class path.";
50+
log.warn(() -> message);
51+
throw new IllegalStateException(message, e);
4852
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
4953
throw new IllegalStateException("Failed to create a web identity token credentials provider.", e);
5054
}

0 commit comments

Comments
 (0)