我正在尝试从 Microsoft 图形中读取用户配置文件/图像,并且正在使用 adal4j-1.5.0.jar 生成 azure 令牌,以便基于令牌我可以调用图形 API/Microsoft delve。我在下面的代码中遇到问题。在不生成令牌或任何异常的情况下,在下面的行之后移动到 finally 块很简单。“未来未来 = context.acquireToken(resourceUri, credential, null);”String clientId = "clientid";String clientSecret = "cleintsecret";String resourceUri = "https://graph.microsoft.com/v1.0/me";String redirectUri = "http://localhost:9082/contextroot";String authorityUri ="https://login.microsoftonline.com/{tenent id}/oauth2/authorize";AuthenticationContext context = null;AuthenticationResult result = null;ExecutorService service = null;try { service = Executors.newFixedThreadPool(1); context = new AuthenticationContext(authorityUri, false, service); ClientCredential credential = new ClientCredential(clientId,clientSecret); Future<AuthenticationResult> future = context.acquireToken(resourceUri, credential, null); result = future.get();}finally { service.shutdown();}
添加回答
举报
0/150
提交
取消