SsoCredentialsProvider ignores the given SDK http client
- Lingua principale
- Java
- Stelle
- 2.6k
- Fork
- 1k
- Merge medio
- 2g 9h
- PR unite (30g)
- 51
Descrizione
## 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da services/sso/src/main/java/software/amazon/awssdk/services/sso/auth/SsoProfileCredentialsProviderFactory.java, nella costruzione di SsoClient alla riga 81, quindi traccia il modo in cui il provider delle credenziali ottiene il proprio client HTTP. Determina come il SdkHttpClient configurato con un proxy di un client SDK potrebbe essere utilizzato o configurato per SSO e verifica che le richieste SSO funzionino attraverso il proxy senza andare in timeout.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, java
- Ambito
- authentication, cloud, networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100