Azure / Azure/azure-sdk-for-java

[FEATURE REQ] AadResourceServerConfiguration should support proxy

Offen
#44,977 3 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @rujche Auf GitHub ansehen
azure-spring customer-reported feature-request needs-team-attention
Vorherrschende Sprache
Java
Sterne
2.6k
Forks
2.2k
Ø Merge
2 T. 2 Std.
Gemergte PRs (30 T.)
205

Beschreibung

**Is your feature request related to a problem? Please describe.**

At the moment it's not possible to easily configure a proxy for the calls the calls to login.microsoft.com. The only way is to fully replace the whole `JwtDecoder` together with the `RestOperation` having the proxy configured.

**Describe the solution you'd like**

Please setup an easy way to configure a proxy for all calls done by the azure-sdk to azure.

**Describe alternatives you've considered**

The current alternative is to duplicate most of the code in `AadResourceServerConfiguration` and setup an extra RestTemplate for the JwtDecoder:

```java
@Bean
RestTemplate aadJwtRestTemplate() {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("myproxyhost", 8080);
factory.setProxy(proxy);
return new RestTemplate(factory);
}

@Bean
JwtDecoder jwtDecoder(AadAuthenticationProperties aadAuthenticationProperties, RestTemplate aadJwtRestTemplate) {
AadAuthorizationServerEndpoints identityEndpoints = new AadAuthorizationServerEndpoints(
aadAuthenticationProperties.getProfile().getEnvironment().getActiveDirectoryEndpoint(), aadAuthenticationProperties.getProfile().getTenantId());
NimbusJwtDecoder nimbusJwtDecoder = NimbusJwtDecoder
.withJwkSetUri(identityEndpoints.getJwkSetEndpoint())
.restOperations(aadJwtRestTemplate) // <--- this is needed, as the current implementation has a static method call to createRestTemplate
.build();
List> validators = createDefaultValidator(aadAuthenticationProperties);
nimbusJwtDecoder.setJwtValidator(new DelegatingOAuth2TokenValidator<>(validators));
return nimbusJwtDecoder;
}

// ... and more to copy & paste
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.