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:
@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<OAuth2TokenValidator<Jwt>> validators = createDefaultValidator(aadAuthenticationProperties);
nimbusJwtDecoder.setJwtValidator(new DelegatingOAuth2TokenValidator<>(validators));
return nimbusJwtDecoder;
}
// ... and more to copy & paste
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
JwtDecodertogether with theRestOperationhaving 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
AadResourceServerConfigurationand setup an extra RestTemplate for the JwtDecoder: