Search in sources :

Example 1 with IPoPAuthenticationSchemeParams

use of com.microsoft.identity.common.internal.authscheme.IPoPAuthenticationSchemeParams in project microsoft-authentication-library-common-for-android by AzureAD.

the class LocalMSALController method generateSignedHttpRequest.

@Override
public GenerateShrResult generateSignedHttpRequest(@NonNull final GenerateShrCommandParameters parameters) throws Exception {
    final Context context = parameters.getAndroidApplicationContext();
    final IClockSkewManager clockSkewManager = new ClockSkewManager(context);
    final OAuth2TokenCache cache = parameters.getOAuth2TokenCache();
    final String clientId = parameters.getClientId();
    final String homeAccountId = parameters.getHomeAccountId();
    final IPoPAuthenticationSchemeParams popSchemeParams = parameters.getPopParameters();
    final GenerateShrResult result;
    if (userHasLocalAccountRecord(cache, clientId, homeAccountId)) {
        // Perform the signing locally...
        result = DevicePoPUtils.generateSignedHttpRequest(context, clockSkewManager, popSchemeParams);
    } else {
        // Populate the error on the result and return...
        result = new GenerateShrResult();
        result.setErrorCode(GenerateShrResult.Errors.NO_ACCOUNT_FOUND);
        result.setErrorMessage("Account does not exist.");
    }
    return result;
}
Also used : Context(android.content.Context) OAuth2TokenCache(com.microsoft.identity.common.internal.providers.oauth2.OAuth2TokenCache) GenerateShrResult(com.microsoft.identity.common.internal.result.GenerateShrResult) IClockSkewManager(com.microsoft.identity.common.internal.util.IClockSkewManager) IClockSkewManager(com.microsoft.identity.common.internal.util.IClockSkewManager) ClockSkewManager(com.microsoft.identity.common.internal.util.ClockSkewManager) IPoPAuthenticationSchemeParams(com.microsoft.identity.common.internal.authscheme.IPoPAuthenticationSchemeParams)

Aggregations

Context (android.content.Context)1 IPoPAuthenticationSchemeParams (com.microsoft.identity.common.internal.authscheme.IPoPAuthenticationSchemeParams)1 OAuth2TokenCache (com.microsoft.identity.common.internal.providers.oauth2.OAuth2TokenCache)1 GenerateShrResult (com.microsoft.identity.common.internal.result.GenerateShrResult)1 ClockSkewManager (com.microsoft.identity.common.internal.util.ClockSkewManager)1 IClockSkewManager (com.microsoft.identity.common.internal.util.IClockSkewManager)1