private bool TryMatchCore(Message message, out KeyValuePair <MessageFilter, FilterData> match)
 {
     match = new KeyValuePair <MessageFilter, FilterData>();
     if (!SecuritySessionFilter.ShouldExcludeMessage(message, this.excludedActions))
     {
         List <UniqueId> list;
         try
         {
             if (!this.TryGetContextIds(message, out list))
             {
                 return(false);
             }
         }
         catch (Exception exception)
         {
             if (!SecuritySessionFilter.CanHandleException(exception))
             {
                 throw;
             }
             return(false);
         }
         for (int i = 0; i < list.Count; i++)
         {
             if (this.contextMappings.TryGetValue(list[i], out match))
             {
                 message.Properties.Remove(SecuritySessionFilter.SessionContextIdsProperty);
                 return(true);
             }
         }
     }
     return(false);
 }
Example #2
0
            bool TryMatchCore(Message message, out KeyValuePair <MessageFilter, FilterData> match)
            {
                match = default(KeyValuePair <MessageFilter, FilterData>);
                if (ShouldExcludeMessage(message, this.excludedActions))
                {
                    return(false);
                }
                List <UniqueId> contextIds;

                try
                {
                    if (!TryGetContextIds(message, out contextIds))
                    {
                        return(false);
                    }
                }
#pragma warning suppress 56500 // covered by FxCOP
                catch (Exception e)
                {
                    if (!SecuritySessionFilter.CanHandleException(e))
                    {
                        throw;
                    }
                    return(false);
                }
                for (int i = 0; i < contextIds.Count; ++i)
                {
                    if (this.contextMappings.TryGetValue(contextIds[i], out match))
                    {
                        message.Properties.Remove(SessionContextIdsProperty);
                        return(true);
                    }
                }
                return(false);
            }