Search in sources :

Example 1 with PopAuthenticationSchemeInternal

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

the class MsalBrokerRequestAdapter method getAuthenticationScheme.

@NonNull
private static AbstractAuthenticationScheme getAuthenticationScheme(@NonNull final Context context, @NonNull final BrokerRequest request) {
    final AbstractAuthenticationScheme requestScheme = request.getAuthenticationScheme();
    if (null == requestScheme) {
        // Default assumes the scheme is Bearer
        return new BearerAuthenticationSchemeInternal();
    } else {
        if (requestScheme instanceof PopAuthenticationSchemeInternal) {
            final IClockSkewManager clockSkewManager = new ClockSkewManager(context);
            ((PopAuthenticationSchemeInternal) requestScheme).setClockSkewManager(clockSkewManager);
        }
        return requestScheme;
    }
}
Also used : AbstractAuthenticationScheme(com.microsoft.identity.common.internal.authscheme.AbstractAuthenticationScheme) BearerAuthenticationSchemeInternal(com.microsoft.identity.common.internal.authscheme.BearerAuthenticationSchemeInternal) IClockSkewManager(com.microsoft.identity.common.internal.util.IClockSkewManager) IClockSkewManager(com.microsoft.identity.common.internal.util.IClockSkewManager) ClockSkewManager(com.microsoft.identity.common.internal.util.ClockSkewManager) PopAuthenticationSchemeInternal(com.microsoft.identity.common.internal.authscheme.PopAuthenticationSchemeInternal) NonNull(androidx.annotation.NonNull)

Example 2 with PopAuthenticationSchemeInternal

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

the class MsalBrokerRequestAdapter method getRequestBundleForGenerateShr.

/**
 * Method to construct a request {@link Bundle} for broker generateShr.
 *
 * @param parameters                      Input request params.
 * @param negotiatedBrokerProtocolVersion The negotiated broker protocol version in use.
 * @return The result Bundle from the Broker.
 */
public Bundle getRequestBundleForGenerateShr(@NonNull final GenerateShrCommandParameters parameters, @NonNull final String negotiatedBrokerProtocolVersion) {
    final String clientId = parameters.getClientId();
    final String homeAccountId = parameters.getHomeAccountId();
    // Convert the supplied public class to the internal representation
    final PopAuthenticationSchemeInternal popParameters = (PopAuthenticationSchemeInternal) AuthenticationSchemeFactory.createScheme(parameters.getAndroidApplicationContext(), (INameable) parameters.getPopParameters());
    final String popParamsJson = sRequestAdapterGsonInstance.toJson(popParameters, PopAuthenticationSchemeInternal.class);
    final Bundle requestBundle = new Bundle();
    requestBundle.putString(ACCOUNT_CLIENTID_KEY, clientId);
    requestBundle.putString(ACCOUNT_HOME_ACCOUNT_ID, homeAccountId);
    requestBundle.putString(AUTH_SCHEME_PARAMS_POP, popParamsJson);
    requestBundle.putString(NEGOTIATED_BP_VERSION_KEY, negotiatedBrokerProtocolVersion);
    return requestBundle;
}
Also used : INameable(com.microsoft.identity.common.internal.authscheme.INameable) Bundle(android.os.Bundle) GzipUtil.compressString(com.microsoft.identity.common.internal.util.GzipUtil.compressString) GzipUtil.decompressBytesToString(com.microsoft.identity.common.internal.util.GzipUtil.decompressBytesToString) PopAuthenticationSchemeInternal(com.microsoft.identity.common.internal.authscheme.PopAuthenticationSchemeInternal)

Aggregations

PopAuthenticationSchemeInternal (com.microsoft.identity.common.internal.authscheme.PopAuthenticationSchemeInternal)2 Bundle (android.os.Bundle)1 NonNull (androidx.annotation.NonNull)1 AbstractAuthenticationScheme (com.microsoft.identity.common.internal.authscheme.AbstractAuthenticationScheme)1 BearerAuthenticationSchemeInternal (com.microsoft.identity.common.internal.authscheme.BearerAuthenticationSchemeInternal)1 INameable (com.microsoft.identity.common.internal.authscheme.INameable)1 ClockSkewManager (com.microsoft.identity.common.internal.util.ClockSkewManager)1 GzipUtil.compressString (com.microsoft.identity.common.internal.util.GzipUtil.compressString)1 GzipUtil.decompressBytesToString (com.microsoft.identity.common.internal.util.GzipUtil.decompressBytesToString)1 IClockSkewManager (com.microsoft.identity.common.internal.util.IClockSkewManager)1