Search in sources :

Example 1 with IAuthenticationResult

use of com.microsoft.aad.msal4j.IAuthenticationResult in project ambry by linkedin.

the class ADAuthBasedStorageClient method refreshToken.

private void refreshToken() throws MalformedURLException, ExecutionException, InterruptedException {
    IAuthenticationResult iAuthenticationResult = getAccessTokenByClientCredentialGrant(azureCloudConfig);
    AccessToken accessToken = new AccessToken(iAuthenticationResult.accessToken(), iAuthenticationResult.expiresOnDate().toInstant().atOffset(OffsetDateTime.now().getOffset()));
    if (accessTokenRef == null) {
        accessTokenRef = new AtomicReference<>(accessToken);
    } else {
        accessTokenRef.set(accessToken);
    }
}
Also used : IAuthenticationResult(com.microsoft.aad.msal4j.IAuthenticationResult) AccessToken(com.azure.core.credential.AccessToken)

Aggregations

AccessToken (com.azure.core.credential.AccessToken)1 IAuthenticationResult (com.microsoft.aad.msal4j.IAuthenticationResult)1