Search in sources :

Example 1 with TokenCommandParameters

use of com.microsoft.identity.common.internal.commands.parameters.TokenCommandParameters in project microsoft-authentication-library-common-for-android by AzureAD.

the class ApiStartEvent method putProperties.

public ApiStartEvent putProperties(@Nullable final CommandParameters parameters) {
    if (parameters == null) {
        return this;
    }
    if (parameters.getSdkType() != null) {
        put(Key.SDK_NAME, parameters.getSdkType().name());
    }
    put(Key.SDK_VERSION, parameters.getSdkVersion());
    // Pii
    put(Key.REDIRECT_URI, parameters.getRedirectUri());
    // Pii
    put(Key.CLIENT_ID, parameters.getClientId());
    put(Key.BROKER_PROTOCOL_VERSION, String.valueOf(parameters.getRequiredBrokerProtocolVersion()));
    if (parameters instanceof TokenCommandParameters) {
        final TokenCommandParameters tokenCommandParameters = (TokenCommandParameters) parameters;
        final Authority authority = tokenCommandParameters.getAuthority();
        if (authority != null) {
            if (authority.getAuthorityURL() != null) {
                // Pii
                put(Key.AUTHORITY, authority.getAuthorityURL().getAuthority());
            }
            put(Key.AUTHORITY_TYPE, authority.getAuthorityTypeString());
        }
        put(Key.CLAIM_REQUEST, StringUtil.isEmpty(tokenCommandParameters.getClaimsRequestJson()) ? Value.FALSE : Value.TRUE);
        if (tokenCommandParameters.getScopes() != null) {
            put(Key.SCOPE_SIZE, String.valueOf(tokenCommandParameters.getScopes().size()));
            // Pii
            put(Key.SCOPE, tokenCommandParameters.getScopes().toString());
        }
        final AbstractAuthenticationScheme authScheme = tokenCommandParameters.getAuthenticationScheme();
        if (null != authScheme) {
            put(Key.AUTHENTICATION_SCHEME, authScheme.getName());
        }
    }
    if (parameters instanceof InteractiveTokenCommandParameters) {
        final InteractiveTokenCommandParameters atOperationParameters = (InteractiveTokenCommandParameters) parameters;
        if (atOperationParameters.getAuthorizationAgent() != null) {
            put(Key.USER_AGENT, atOperationParameters.getAuthorizationAgent().name());
        }
        put(// Pii
        Key.LOGIN_HINT, atOperationParameters.getLoginHint());
        if (atOperationParameters.getExtraQueryStringParameters() != null) {
            put(// Pii
            Key.REQUEST_QUERY_PARAMS, String.valueOf(atOperationParameters.getExtraQueryStringParameters().size()));
        }
        if (atOperationParameters.getPrompt() != null) {
            put(Key.PROMPT_BEHAVIOR, atOperationParameters.getPrompt().toString());
        }
    }
    if (parameters instanceof SilentTokenCommandParameters) {
        final SilentTokenCommandParameters silentParameters = (SilentTokenCommandParameters) parameters;
        if (silentParameters.getAccount() != null) {
            // Pii
            put(Key.USER_ID, silentParameters.getAccount().getHomeAccountId());
        }
        put(Key.IS_FORCE_REFRESH, String.valueOf(silentParameters.isForceRefresh()));
    }
    if (parameters instanceof BrokerInteractiveTokenCommandParameters) {
    // TODO when integrate the telemetry with broker.
    }
    if (parameters instanceof BrokerSilentTokenCommandParameters) {
    // TODO when integrate the telemetry with broker.
    }
    return this;
}
Also used : AbstractAuthenticationScheme(com.microsoft.identity.common.internal.authscheme.AbstractAuthenticationScheme) SilentTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.SilentTokenCommandParameters) BrokerSilentTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.BrokerSilentTokenCommandParameters) BrokerSilentTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.BrokerSilentTokenCommandParameters) InteractiveTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.InteractiveTokenCommandParameters) BrokerInteractiveTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.BrokerInteractiveTokenCommandParameters) SilentTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.SilentTokenCommandParameters) TokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.TokenCommandParameters) BrokerSilentTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.BrokerSilentTokenCommandParameters) Authority(com.microsoft.identity.common.internal.authorities.Authority) InteractiveTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.InteractiveTokenCommandParameters) BrokerInteractiveTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.BrokerInteractiveTokenCommandParameters) BrokerInteractiveTokenCommandParameters(com.microsoft.identity.common.internal.commands.parameters.BrokerInteractiveTokenCommandParameters)

Aggregations

Authority (com.microsoft.identity.common.internal.authorities.Authority)1 AbstractAuthenticationScheme (com.microsoft.identity.common.internal.authscheme.AbstractAuthenticationScheme)1 BrokerInteractiveTokenCommandParameters (com.microsoft.identity.common.internal.commands.parameters.BrokerInteractiveTokenCommandParameters)1 BrokerSilentTokenCommandParameters (com.microsoft.identity.common.internal.commands.parameters.BrokerSilentTokenCommandParameters)1 InteractiveTokenCommandParameters (com.microsoft.identity.common.internal.commands.parameters.InteractiveTokenCommandParameters)1 SilentTokenCommandParameters (com.microsoft.identity.common.internal.commands.parameters.SilentTokenCommandParameters)1 TokenCommandParameters (com.microsoft.identity.common.internal.commands.parameters.TokenCommandParameters)1