use of com.microsoft.identity.common.internal.broker.BrokerResult in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalBrokerResultAdapter method bundleFromAuthenticationResult.
@Override
@NonNull
public Bundle bundleFromAuthenticationResult(@NonNull final ILocalAuthenticationResult authenticationResult, @Nullable final String negotiatedBrokerProtocolVersion) {
Logger.info(TAG, "Constructing result bundle from ILocalAuthenticationResult");
final IAccountRecord accountRecord = authenticationResult.getAccountRecord();
final AccessTokenRecord accessTokenRecord = authenticationResult.getAccessTokenRecord();
final BrokerResult brokerResult = new BrokerResult.Builder().tenantProfileRecords(authenticationResult.getCacheRecordWithTenantProfileData()).accessToken(authenticationResult.getAccessToken()).idToken(authenticationResult.getIdToken()).refreshToken(authenticationResult.getRefreshToken()).homeAccountId(accountRecord.getHomeAccountId()).localAccountId(accountRecord.getLocalAccountId()).userName(accountRecord.getUsername()).tokenType(accessTokenRecord.getAccessTokenType()).clientId(accessTokenRecord.getClientId()).familyId(authenticationResult.getFamilyId()).scope(accessTokenRecord.getTarget()).clientInfo(accountRecord.getClientInfo()).authority(accessTokenRecord.getAuthority()).environment(accessTokenRecord.getEnvironment()).tenantId(authenticationResult.getTenantId()).expiresOn(Long.parseLong(accessTokenRecord.getExpiresOn())).extendedExpiresOn(Long.parseLong(accessTokenRecord.getExtendedExpiresOn())).cachedAt(Long.parseLong(accessTokenRecord.getCachedAt())).speRing(authenticationResult.getSpeRing()).refreshTokenAge(authenticationResult.getRefreshTokenAge()).success(true).servicedFromCache(authenticationResult.isServicedFromCache()).build();
final Bundle resultBundle = bundleFromBrokerResult(brokerResult, negotiatedBrokerProtocolVersion);
resultBundle.putBoolean(AuthenticationConstants.Broker.BROKER_REQUEST_V2_SUCCESS, true);
return resultBundle;
}
Aggregations