我不知道如何使用adal4j库获取没有用户名和密码的令牌。我有这样的代码:
public class GetToken implements AuthenticationCallback {
public static void main(String[] args) {
// TODO Auto-generated method stub
String resource = "resource";
String redirectUrl = "redirecturl";
String authority = "https://login.microsoftonline.com/common/";
ExecutorService executor = null;
ClientAssertion clientId = new ClientAssertion("my-client-id");
AuthenticationCallback callback;
// Authenticate the registered application with Azure Active Directory.
AuthenticationContext authContext;
try {
authContext = new AuthenticationContext(authority, false,executor);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Future <AuthenticationResult> result = authContext.acquireToken(resource, clientId, callback);
}
@Override
public void onSuccess(AuthenticationResult result) {
// TODO Auto-generated method stub
}
@Override
public void onFailure(Throwable exc) {
// TODO Auto-generated method stub
}
}我不知道怎么弄到令牌...
发布于 2017-07-11 09:13:30
Look into the getAccessToke() method.This就是你要找的:
ExecutorService executor = Executors.newFixedThreadPool(1);希望这能有所帮助!
发布于 2016-09-20 05:53:18
当传递给AuthenticationContext的Executor服务为空时,您将得到一个IllegalArgumentException。
https://stackoverflow.com/questions/39527324
复制相似问题