public PropertyBag(EventType eventType, IErrorStore errorStore) { _errorStore = errorStore; _contents = new PropertyBagContents(eventType); SetErrorType(eventType); _count = 1; }
private bool IsMsalActionSilent(PropertyBagContents contents) { string isSilentUi = string.Empty; contents.StringProperties.TryGetValue(MsalTelemetryBlobEventNames.IsSilentTelemetryBatchKey, out isSilentUi); string uiEventCount = string.Empty; contents.StringProperties.TryGetValue(MsalTelemetryBlobEventNames.UiEventCountTelemetryBatchKey, out uiEventCount); bool isBlocking = false; contents.BoolProperties.TryGetValue(ActionPropertyNames.BlockingPromptConstStrKey, out isBlocking); bool askedForCredentials = false; contents.BoolProperties.TryGetValue(ActionPropertyNames.AskedForCredsConstStrKey, out askedForCredentials); // todo: if we can't find one of these properties, do this below... //if (!error.empty()) //{ // MatsPrivate::ReportError(error, ErrorType::OTHER, ErrorSeverity::LIBRARY_ERROR); // return true; //} if (isSilentUi == "false" || (string.IsNullOrEmpty(isSilentUi) && uiEventCount != "0" && !string.IsNullOrEmpty(uiEventCount)) || isBlocking == true || askedForCredentials == true) { return(false); } return(true); }
public bool ShouldAggregateAction(PropertyBagContents contents) { if (_enableAggregation) { return(IsSuccessfulAction(contents) && IsSilentAction(contents)); } return(false); }
private bool IsSuccessfulAction(PropertyBagContents contents) { if (IsOfActionType(ActionType.Msal, contents.StringProperties)) { return(IsMsalActionSuccessful(contents)); } return(HasActionOutcome(AuthOutcome.Succeeded, contents.StringProperties)); }
private bool IsMsalActionSuccessful(PropertyBagContents contents) { if (contents.StringProperties.TryGetValue(MsalTelemetryBlobEventNames.IsSuccessfulConstStrKey, out string isSuccessful)) { return(isSuccessful.Equals(MsalTelemetryBlobEventValues.IsSuccessfulConstStrValue) && HasActionOutcome(AuthOutcome.Succeeded, contents.StringProperties)); } // MatsPrivate::ReportError("Could not retrieve MSAL is_successful property.", ErrorType::OTHER, ErrorSeverity::LIBRARY_ERROR); return(false); }
public static ITelemetryEventPayload Create(string name, PropertyBagContents contents) { var batch = new TelemetryEventPayload(name); batch.SetStringData(contents.StringProperties); batch.SetIntData(contents.IntProperties); batch.SetInt64Data(contents.Int64Properties); batch.SetBoolData(contents.BoolProperties); return(batch); }
private bool IsPropertyNameUnique(string name, PropertyBagContents content) { if (content.BoolProperties.ContainsKey(name) || content.StringProperties.ContainsKey(name) || content.IntProperties.ContainsKey(name) || content.Int64Properties.ContainsKey(name)) { return(false); } return(true); }
public bool IsSilentAction(PropertyBagContents contents) { if (IsOfActionType(ActionType.Msal, contents.StringProperties)) { return(IsMsalActionSilent(contents)); } if (contents.BoolProperties.TryGetValue(ActionPropertyNames.IsSilentConstStrKey, out bool isSilent)) { return(isSilent); } // MatsPrivate::ReportError("Could not retrieve IsSilent property.", ErrorType::OTHER, ErrorSeverity::LIBRARY_ERROR); return(false); }
private bool IsNameValidForAdd(string name, PropertyBagContents content, out string errorMessage) { errorMessage = string.Empty; if (!MatsUtils.IsValidPropertyName(name, out errorMessage)) { return(false); } if (!IsPropertyNameUnique(name, content)) { errorMessage = string.Format(CultureInfo.InvariantCulture, "Property Name '{0}' is not unique", name); return(false); } return(true); }