Source:
<code>public void onReceive(Context context, Intent intent) { final String methodName = ":BrokerInstallLocalReceiver:onReceive"; Logger.d(TAG + methodName, "Received result from broker."); final int receivedWaitingRequestId = intent.getIntExtra(AuthenticationConstants.Browser.REQUEST_ID, 0); if (receivedWaitingRequestId == 0) { Logger.v(TAG + methodName, "Received waiting request is 0, error will be thrown, cannot find correct " + "callback to send back the result."); throw new AuthenticationException(ADALError.AUTH_FAILED_NO_STATE, "Received waiting request id is 0."); } final AuthenticationRequestState waitingRequest = getWaitingRequest(receivedWaitingRequestId); final String errorCode = intent.getStringExtra(AuthenticationConstants.Browser.RESPONSE_ERROR_CODE); if (!StringExtensions.IsNullOrBlank(errorCode)) { final String errorMessage = intent.getStringExtra(AuthenticationConstants.Browser.RESPONSE_ERROR_MESSAGE); final String returnedErrorMessage = "ErrorCode: " + errorCode + " ErrorMessage" + errorMessage + getCorrelationInfoFromWaitingRequest(waitingRequest); Logger.v(TAG + methodName, returnedErrorMessage); waitingRequestOnError(waitingRequest, receivedWaitingRequestId, new AuthenticationException(ADALError.AUTH_FAILED, returnedErrorMessage)); } else { Logger.v(TAG + methodName, "Received token result from broker reqest resume."); <START> final AuthenticationResult brokerResult = processTokenResultFromBroker(intent); <END> if (brokerResult != null && brokerResult.getAccessToken() != null) { Logger.v(TAG + methodName, "Broker resume request successfully returns the access token."); waitingRequest.mDelagete.onSuccess(brokerResult); } else { Logger.v(TAG + methodName, "No access token returned from broker resume request."); waitingRequest.mDelagete.onError(new AuthenticatorException("No access token returned from broker.")); } } }</code><technical_language>do forget - do ensure intended app process token result some malicious app</technical_language>

Target:
public void onReceive(Context context, Intent intent) { final String methodName = ":BrokerResumeResultReceiver:onReceive"; Logger.d(TAG + methodName, "Received result from broker."); final int receivedWaitingRequestId = intent.getIntExtra(AuthenticationConstants.Browser.REQUEST_ID, 0); if (receivedWaitingRequestId == 0) { Logger.v(TAG + methodName, "Received waiting request is 0, error will be thrown, cannot find correct " + "callback to send back the result."); return; } receivedResultFromBroker = true; final AuthenticationRequestState waitingRequest = getWaitingRequest(receivedWaitingRequestId); final String errorCode = intent.getStringExtra(AuthenticationConstants.Browser.RESPONSE_ERROR_CODE); if (!StringExtensions.IsNullOrBlank(errorCode)) { final String errorMessage = intent.getStringExtra(AuthenticationConstants.Browser.RESPONSE_ERROR_MESSAGE); final String returnedErrorMessage = "ErrorCode: " + errorCode + " ErrorMessage" + errorMessage + getCorrelationInfoFromWaitingRequest(waitingRequest); Logger.v(TAG + methodName, returnedErrorMessage); waitingRequestOnError(waitingRequest, receivedWaitingRequestId, new AuthenticationException(ADALError.AUTH_FAILED, returnedErrorMessage)); } else { final boolean isBrokerCompleteTokenRequest = intent.getBooleanExtra(AuthenticationConstants.Broker.BROKER_RESULT_RETURNED, false); if (isBrokerCompleteTokenRequest) { Logger.v(TAG + methodName, "Broker already completed the token request, calling acquireTokenSilentSync to retrieve token from broker."); final AuthenticationRequest authenticationRequest = waitingRequest.mRequest; String userId = intent.getStringExtra(AuthenticationConstants.Broker.ACCOUNT_USERINFO_USERID); if (StringExtensions.IsNullOrBlank(userId)) { userId = authenticationRequest.getUserId(); } acquireTokenSilentAsync(authenticationRequest.getResource(), authenticationRequest.getClientId(), userId, waitingRequest.mDelagete); } else { Logger.v(TAG + methodName, "Broker doesn't send back error nor the completion notification."); waitingRequestOnError(waitingRequest, receivedWaitingRequestId, new AuthenticationException(ADALError.AUTH_FAILED, "Broker doesn't send back error nor the completion notification.")); } } (new ContextWrapper(mContext)).unregisterReceiver(mBrokerResumeResultReceiver); }