【发布时间】:2021-05-28 12:28:48
【问题描述】:
我正在尝试实现 GraphClient,下面是一个运行良好的示例代码...
ClientCredentialProvider authProvider =
new ClientCredentialProvider(clientId,
scopes,
clientSecret,
b2cTenant,
endpoint);
IGraphServiceClient graphClient = graphClient = GraphServiceClient.builder()
.authenticationProvider(authProvider)
.buildClient();
这工作正常......但在某些情况下,从运行代码的地方,有一个代理,所以我需要设置代理来连接到互联网。我需要设置代理并以某种方式将其传递给 graphClient 以告知通过代理拨打电话。
我试图找到一份文件,但找不到任何文件...
ProxyOptions proxyOptions = new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(proxyUrl, proxyPort));
proxyOptions.setCredentials(proxyUser, proxyPassword);
final UsernamePasswordCredential usernamePasswordCredential = new UsernamePasswordCredentialBuilder()
.clientId(clientId)
.username(username)
.password(password)
.httpClient(HttpClient.createDefault(new HttpClientOptions().setProxyOptions(proxyOptions)))
.build();
但问题是 Maven 中没有“ProxyOptions”,我不确定它属于哪个库。
任何人都可以提出一个想法。
【问题讨论】:
标签: java proxy microsoft-graph-api azure-ad-b2c azure-ad-graph-api