am trying to read user profile/image form Microsoft graphic and am using adal4j-1.5.0.jar to generate the azure token so that based on token i can make a call to graphic API/Microsoft delve.
i am facing issue in below code. it was simple moving to finally block after below line without generating token or any exception. "Future future = 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();
}