SsoCredentialsProvider ignores the given SDK http client
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 51
Description
## Describe the bug
I'm sitting behind an enterprise proxy, where my company recently started using AWS CLI v2 SSO.
We create our AWS SDK clients like this
```
public SsmClient configureSsmClient() {
return SsmClient.builder()
.region(Region.of(props.getRegion().getName()))
.httpClient(sdkHttpClient)
.build();
}
```
where the `sdkHttpClient` will conditinally have a proxy set which we can use when e.g. debugging locally.
However after starting to use SSO, when debugging locally we are seeing connection timeouts, suggesting the the proxy is not being used.
Looking at [the code for SsoProfileCredentialsProviderFactory](https://github.com/aws/aws-sdk-java-v2/blob/master/services/sso/src/main/java/software/amazon/awssdk/services/sso/auth/SsoProfileCredentialsProviderFactory.java#L81), on line 81 a new `SsoClient` is created. It does not set any httpClient, and as far as I can tell it provides no way of doing so.
This means it's currently impossible to use the SsoProfileCredentialsProviderFactory when sitting behind a proxy.
## Expected Behavior
Except having to add a dependency on `'software.amazon.awssdk:sso'`, I expected the DefaultCredentialsProvider to just pickup my SSO credentials.
## Current Behavior
The SSO http client times out as soon as the first call using an SDK client is made
```
ProfileCredentialsProvider(profileName=my-profile) ..... : Unable to execute HTTP request: Connect to portal.sso.eu-west-1.amazonaws.com:443 [portal.sso.eu-west-1.amazonaws.com/54.171.10.188, portal.sso.eu-west-1.amazonaws.com/54.77.233.164, portal.sso.eu-west-1.amazonaws.com/54.73.33.113] failed: connect timed out
```
## Steps to Reproduce
Attempt to use SSO while sitting behind a proxy
## Possible Solution
SsoProfileCredentialsProviderFactory should use the SdkHttpClient passed to the AWS SDK client, or at least provide a way of setting the http client used by the SsoClient
## Context
We are unable to debug without jumping through hoops, manually copying keys and secrets to use the old `~/.aws/credentials` file instead of SSO.
## Your Environment
* AWS Java SDK version used: 2.16.70
* JDK version used: 11.0.8
* Operating System and version: Linux/4.19.104-microsoft-standard source/x86_64.ubuntu.20
Contributor guide
Research direction
Start with services/sso/src/main/java/software/amazon/awssdk/services/sso/auth/SsoProfileCredentialsProviderFactory.java at the SsoClient construction on line 81, then trace how the credentials provider obtains its HTTP client. Determine how an SDK client’s proxy-configured SdkHttpClient could be used or configured for SSO, and verify that SSO requests work through the proxy without timing out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, java
- Domain
- authentication, cloud, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100