Ejemplo n.º 1
0
        private void CreateNotification(IEnumerable <ExchangeCertificate> certificates, bool isExpired)
        {
            ADRecipientOrAddress       owner = null;
            MicrosoftExchangeRecipient microsoftExchangeRecipient = this.adSession.FindMicrosoftExchangeRecipient();

            if (microsoftExchangeRecipient == null)
            {
                this.EventLog.LogEvent(CertificateNotificationEventLogConstants.Tuple_MicrosoftExchangeRecipientNotFoundException, string.Empty, new object[]
                {
                    string.Empty
                });
            }
            else
            {
                owner = new ADRecipientOrAddress(new Participant(microsoftExchangeRecipient));
            }
            foreach (ExchangeCertificate exchangeCertificate in certificates)
            {
                KeyValuePair <string, LocalizedString>[] extendedAttributes = new KeyValuePair <string, LocalizedString>[]
                {
                    new KeyValuePair <string, LocalizedString>("ServerName", new LocalizedString(this.serverObj.Name)),
                    new KeyValuePair <string, LocalizedString>("ServerFqdn", new LocalizedString(this.serverObj.Fqdn)),
                    new KeyValuePair <string, LocalizedString>("ThumbPrint", new LocalizedString(exchangeCertificate.Thumbprint)),
                    new KeyValuePair <string, LocalizedString>("FriendlyName", new LocalizedString(exchangeCertificate.FriendlyName)),
                    new KeyValuePair <string, LocalizedString>("ExpireDate", new LocalizedString(exchangeCertificate.NotAfter.ToFileTimeUtc().ToString()))
                };
                string id = this.serverObj.Fqdn + "\\" + exchangeCertificate.Thumbprint;
                AsyncOperationNotificationDataProvider.CreateNotification(this.orgId, id, AsyncOperationType.CertExpiry, isExpired ? AsyncOperationStatus.CertExpired : AsyncOperationStatus.CertExpiring, new LocalizedString(exchangeCertificate.FriendlyName), owner, extendedAttributes, false);
                AsyncOperationNotificationDataProvider.SendNotificationEmail(this.orgId, id, false, null, false);
            }
        }
Ejemplo n.º 2
0
 public static PeopleIdentity ToPeopleIdentity(this ADRecipientOrAddress entry)
 {
     if (entry != null)
     {
         return(new PeopleIdentity(entry.DisplayName, entry.Address, entry.Address, (entry.RoutingType == "EX") ? 2 : 3, entry.RoutingType, 0));
     }
     return(null);
 }
Ejemplo n.º 3
0
 public static ADRecipientOrAddress Redact(ADRecipientOrAddress value, out string raw, out string redacted)
 {
     raw      = null;
     redacted = null;
     if (value == null)
     {
         return(null);
     }
     return(new ADRecipientOrAddress(new Participant(SuppressingPiiData.Redact(value.DisplayName, out raw, out redacted), SuppressingPiiData.Redact(value.Address, out raw, out redacted), null)));
 }
Ejemplo n.º 4
0
        public static PeopleIdentity ToPeopleIdentity(this SmtpAddress?address)
        {
            ADRecipientOrAddress adrecipientOrAddress = address.ToADRecipientOrAddress();

            if (adrecipientOrAddress != null)
            {
                return(adrecipientOrAddress.ToPeopleIdentity());
            }
            return(null);
        }
Ejemplo n.º 5
0
        public static ADRecipientOrAddress[] ResolveRecipients(IList <RecipientIdParameter> recipientIDs, DataAccessHelper.GetDataObjectDelegate getRecipientObject, IRecipientSession recipientSession, ManageInboxRule.ThrowTerminatingErrorDelegate errorHandler)
        {
            if (recipientIDs == null || recipientIDs.Count == 0)
            {
                return(null);
            }
            ADRecipientOrAddress[] array = new ADRecipientOrAddress[recipientIDs.Count];
            int num = 0;

            foreach (RecipientIdParameter recipientIdParameter in recipientIDs)
            {
                try
                {
                    recipientIdParameter.SearchWithDisplayName = false;
                    ADRecipient adEntry = (ADRecipient)getRecipientObject(recipientIdParameter, recipientSession, null, null, new LocalizedString?(Strings.ErrorRecipientNotFound(recipientIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(recipientIdParameter.ToString())));
                    array[num++] = new ADRecipientOrAddress(new Participant(adEntry));
                }
                catch (ManagementObjectNotFoundException)
                {
                    MimeRecipient mimeRecipient = null;
                    try
                    {
                        mimeRecipient = MimeRecipient.Parse(recipientIdParameter.RawIdentity, AddressParserFlags.IgnoreComments | AddressParserFlags.AllowSquareBrackets);
                    }
                    catch (MimeException)
                    {
                    }
                    if (mimeRecipient == null || string.IsNullOrEmpty(mimeRecipient.Email) || !SmtpAddress.IsValidSmtpAddress(mimeRecipient.Email))
                    {
                        errorHandler(new LocalizedException(Strings.ErrorInboxRuleUserInvalid(recipientIdParameter.ToString())), ErrorCategory.InvalidArgument, null);
                    }
                    string text = string.Empty;
                    try
                    {
                        text = mimeRecipient.DisplayName;
                    }
                    catch (MimeException)
                    {
                    }
                    if (string.IsNullOrEmpty(text))
                    {
                        text = mimeRecipient.Email;
                    }
                    array[num++] = new ADRecipientOrAddress(new Participant(text, mimeRecipient.Email, "smtp"));
                }
            }
            return(array);
        }