com.microsoft.aad.msal4j.AccountsSupplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of msal4j Show documentation
Show all versions of msal4j Show documentation
Microsoft Authentication Library for Java gives you the ability to obtain tokens from Azure AD v2 (work and school
accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft
identities
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;
import java.net.URL;
import java.util.Set;
import java.util.concurrent.CompletionException;
import java.util.function.Supplier;
class AccountsSupplier implements Supplier> {
AbstractClientApplicationBase clientApplication;
MsalRequest msalRequest;
AccountsSupplier(AbstractClientApplicationBase clientApplication, MsalRequest msalRequest) {
this.clientApplication = clientApplication;
this.msalRequest = msalRequest;
}
@Override
public Set get() {
try {
return clientApplication.tokenCache.getAccounts
(clientApplication.clientId());
} catch (Exception ex) {
clientApplication.log.error(
LogHelper.createMessage("Execution of " + this.getClass() + " failed.",
msalRequest.headers().getHeaderCorrelationIdValue()), ex);
throw new CompletionException(ex);
}
}
}