1

我正在尝试使用adal4j@1.6.4java 库与 azure 连接以获取访问令牌。我的应用程序位于公司代理后面,因此我必须设置代理才能连接到 azure。

以下是代码片段

String url = "https://login.microsoftonline.com/tenant_id/oauth2/authorize";
authContext = new AuthenticationContext(url,false, service);
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyhostname", 8080));
authContext.setProxy(proxy);
ClientCredential clientCred = new ClientCredential(XXXX, xxxx);
Future future = authContext.acquireToken(clientCred,null);
authResult = future.get();

当我使用代理连接时,我收到证书错误。

0:53:23.561 [pool-1-thread-1] ERROR com.microsoft.aad.adal4j.AuthenticationContext - [Correlation ID: xxxxxxxxxxxxxxxxxxxxxxx] Execution of class com.microsoft.aad.adal4j.AcquireTokenCallable failed.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
4

0 回答 0