Jar fle from Maven Repository
1 2 3 4 5 |
<dependency> <groupId>com.microsoft.azure</groupId> <artifactId>adal4j</artifactId> <version>1.2.0</version> </dependency> |
Code Example
1 2 3 4 5 6 7 8 9 |
ExecutorService service = Executors.newFixedThreadPool(1); AuthenticationContext context = new AuthenticationContext(AUTHORITY, false, service); Future<AuthenticationResult> future = context.acquireToken( "https://graph.windows.net", YOUR_TENANT_ID, username, password, null); AuthenticationResult result = future.get(); System.out.println("Access Token - " + result.getAccessToken()); System.out.println("Refresh Token - " + result.getRefreshToken()); System.out.println("ID Token - " + result.getIdToken()); |
Example Identity Management Rep
https://github.com/Azure-Samples/ms-identity-java-webapp
s
Ref:
github.com/Azure-Samples/ms-identity-java-webapp/tree/master/msal-java-webapp-sample