Я использую msal4j
, чтобы получить Access Token
с пользователем и паролем:
PublicClientApplication app = PublicClientApplication
.builder(CLIENT_ID)
.authority("https://login.microsoftonline.com/organizations")
.build();
CompletableFuture<IAuthenticationResult> acquireToken = app.acquireToken(
UserNamePasswordParameters.builder(
SCOPE, USER_NAME, USER_PASSWORD.toCharArray())
.build());
IAuthenticationResult authenticationResult = acquireToken.join();
System.out.println(authenticationResult.expiresOnDate());
String accessToken = authenticationResult.accessToken();
String idtoken = authenticationResult.idToken();
System.out.println(accessToken);
System.out.println(idtoken);
Как только у меня есть токен, предоставленный объектом IAuthenticationResult
, я хотел бы проверить токен доступа в будущем вызове.
https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens#validating-tokens.
Как это сделать с Java?
Спасибо заранее
Хуан Антонио