我正在嘗試從 Microsoft 圖形中讀取用戶配置文件/圖像,并且正在使用 adal4j-1.5.0.jar 生成 azure 令牌,以便基于令牌我可以調(diào)用圖形 API/Microsoft delve。我在下面的代碼中遇到問(wèn)題。在不生成令牌或任何異常的情況下,在下面的行之后移動(dòng)到 finally 塊很簡(jiǎn)單?!拔磥?lái)未來(lái) = 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();}
添加回答
舉報(bào)
0/150
提交
取消