2016-09-16 8 views
0

adal4jライブラリを使用してユーザー名とパスワードなしでトークンを取得する方法がわかりません。 AuthenticationContextに渡されたエグゼキュータのサービスがnullであるとしてあなたは、IllegalArgumentExceptionを取得しますadal4jでトークンを取得しようとしています

+0

あなたが得ているエラーとそれ以外のものを説明してください –

答えて

-1

....

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 

    } 

} 

そして、私はトークンを取得する方法がわからない:私はこのコードを持っています。スローされた例外を共有できますか?

+0

これは質問に答えないのでコメントにする必要があります –

関連する問題