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;
}
Aggregations