コード例 #1
0
 // if expectedAppliesToQName is null all issuances matching the actors are returned.
 internal static Collection<RequestSecurityTokenResponse> ExtractIssuances(Message message, SecurityStandardsManager standardsManager, string[] actors, XmlQualifiedName expectedAppliesToQName)
 {
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
     }
     if (standardsManager == null)
     {
         standardsManager = SecurityStandardsManager.DefaultInstance;
     }
     if (actors == null)
     {
         throw TraceUtility.ThrowHelperArgumentNull("actors", message);
     }
     Collection<RequestSecurityTokenResponse> issuances = new Collection<RequestSecurityTokenResponse>();
     for (int i = 0; i < message.Headers.Count; ++i)
     {
         if (message.Headers[i].Name == standardsManager.TrustDriver.IssuedTokensHeaderName && message.Headers[i].Namespace == standardsManager.TrustDriver.IssuedTokensHeaderNamespace)
         {
             bool isValidActor = false;
             for (int j = 0; j < actors.Length; ++j)
             {
                 if (actors[j] == message.Headers[i].Actor)
                 {
                     isValidActor = true;
                     break;
                 }
             }
             if (!isValidActor)
             {
                 continue;
             }
             IssuedTokensHeader issuedTokensHeader = new IssuedTokensHeader(message.Headers.GetReaderAtHeader(i), message.Version, standardsManager);
             for (int k = 0; k < issuedTokensHeader.TokenIssuances.Count; ++k)
             {
                 bool isMatch;
                 if (expectedAppliesToQName != null)
                 {
                     string issuanceAppliesToName;
                     string issuanceAppliesToNs;
                     issuedTokensHeader.TokenIssuances[k].GetAppliesToQName(out issuanceAppliesToName, out issuanceAppliesToNs);
                     if (issuanceAppliesToName == expectedAppliesToQName.Name && issuanceAppliesToNs == expectedAppliesToQName.Namespace)
                     {
                         isMatch = true;
                     }
                     else
                     {
                         isMatch = false;
                     }
                 }
                 else
                 {
                     isMatch = true;
                 }
                 if (isMatch)
                 {
                     issuances.Add(issuedTokensHeader.TokenIssuances[k]);
                 }
             }
         }
     }
     return issuances;
 }
 internal static Collection<RequestSecurityTokenResponse> ExtractIssuances(Message message, SecurityStandardsManager standardsManager, string[] actors, XmlQualifiedName expectedAppliesToQName)
 {
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
     }
     if (standardsManager == null)
     {
         standardsManager = SecurityStandardsManager.DefaultInstance;
     }
     if (actors == null)
     {
         throw TraceUtility.ThrowHelperArgumentNull("actors", message);
     }
     Collection<RequestSecurityTokenResponse> collection = new Collection<RequestSecurityTokenResponse>();
     for (int i = 0; i < message.Headers.Count; i++)
     {
         if (!(message.Headers[i].Name == standardsManager.TrustDriver.IssuedTokensHeaderName) || !(message.Headers[i].Namespace == standardsManager.TrustDriver.IssuedTokensHeaderNamespace))
         {
             continue;
         }
         bool flag = false;
         for (int j = 0; j < actors.Length; j++)
         {
             if (actors[j] == message.Headers[i].Actor)
             {
                 flag = true;
                 break;
             }
         }
         if (flag)
         {
             IssuedTokensHeader header = new IssuedTokensHeader(message.Headers.GetReaderAtHeader(i), message.Version, standardsManager);
             for (int k = 0; k < header.TokenIssuances.Count; k++)
             {
                 bool flag2;
                 if (expectedAppliesToQName != null)
                 {
                     string str;
                     string str2;
                     header.TokenIssuances[k].GetAppliesToQName(out str, out str2);
                     if ((str == expectedAppliesToQName.Name) && (str2 == expectedAppliesToQName.Namespace))
                     {
                         flag2 = true;
                     }
                     else
                     {
                         flag2 = false;
                     }
                 }
                 else
                 {
                     flag2 = true;
                 }
                 if (flag2)
                 {
                     collection.Add(header.TokenIssuances[k]);
                 }
             }
         }
     }
     return collection;
 }
コード例 #3
0
        internal static Collection <RequestSecurityTokenResponse> ExtractIssuances(Message message, SecurityStandardsManager standardsManager, string[] actors, XmlQualifiedName expectedAppliesToQName)
        {
            if (message == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
            }
            if (standardsManager == null)
            {
                standardsManager = SecurityStandardsManager.DefaultInstance;
            }
            if (actors == null)
            {
                throw TraceUtility.ThrowHelperArgumentNull("actors", message);
            }
            Collection <RequestSecurityTokenResponse> collection = new Collection <RequestSecurityTokenResponse>();

            for (int i = 0; i < message.Headers.Count; i++)
            {
                if (!(message.Headers[i].Name == standardsManager.TrustDriver.IssuedTokensHeaderName) || !(message.Headers[i].Namespace == standardsManager.TrustDriver.IssuedTokensHeaderNamespace))
                {
                    continue;
                }
                bool flag = false;
                for (int j = 0; j < actors.Length; j++)
                {
                    if (actors[j] == message.Headers[i].Actor)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    IssuedTokensHeader header = new IssuedTokensHeader(message.Headers.GetReaderAtHeader(i), message.Version, standardsManager);
                    for (int k = 0; k < header.TokenIssuances.Count; k++)
                    {
                        bool flag2;
                        if (expectedAppliesToQName != null)
                        {
                            string str;
                            string str2;
                            header.TokenIssuances[k].GetAppliesToQName(out str, out str2);
                            if ((str == expectedAppliesToQName.Name) && (str2 == expectedAppliesToQName.Namespace))
                            {
                                flag2 = true;
                            }
                            else
                            {
                                flag2 = false;
                            }
                        }
                        else
                        {
                            flag2 = true;
                        }
                        if (flag2)
                        {
                            collection.Add(header.TokenIssuances[k]);
                        }
                    }
                }
            }
            return(collection);
        }
コード例 #4
0
        // if expectedAppliesToQName is null all issuances matching the actors are returned.
        internal static Collection <RequestSecurityTokenResponse> ExtractIssuances(Message message, SecurityStandardsManager standardsManager, string[] actors, XmlQualifiedName expectedAppliesToQName)
        {
            if (message == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
            }
            if (standardsManager == null)
            {
                standardsManager = SecurityStandardsManager.DefaultInstance;
            }
            if (actors == null)
            {
                throw TraceUtility.ThrowHelperArgumentNull("actors", message);
            }
            Collection <RequestSecurityTokenResponse> issuances = new Collection <RequestSecurityTokenResponse>();

            for (int i = 0; i < message.Headers.Count; ++i)
            {
                if (message.Headers[i].Name == standardsManager.TrustDriver.IssuedTokensHeaderName && message.Headers[i].Namespace == standardsManager.TrustDriver.IssuedTokensHeaderNamespace)
                {
                    bool isValidActor = false;
                    for (int j = 0; j < actors.Length; ++j)
                    {
                        if (actors[j] == message.Headers[i].Actor)
                        {
                            isValidActor = true;
                            break;
                        }
                    }
                    if (!isValidActor)
                    {
                        continue;
                    }
                    IssuedTokensHeader issuedTokensHeader = new IssuedTokensHeader(message.Headers.GetReaderAtHeader(i), message.Version, standardsManager);
                    for (int k = 0; k < issuedTokensHeader.TokenIssuances.Count; ++k)
                    {
                        bool isMatch;
                        if (expectedAppliesToQName != null)
                        {
                            string issuanceAppliesToName;
                            string issuanceAppliesToNs;
                            issuedTokensHeader.TokenIssuances[k].GetAppliesToQName(out issuanceAppliesToName, out issuanceAppliesToNs);
                            if (issuanceAppliesToName == expectedAppliesToQName.Name && issuanceAppliesToNs == expectedAppliesToQName.Namespace)
                            {
                                isMatch = true;
                            }
                            else
                            {
                                isMatch = false;
                            }
                        }
                        else
                        {
                            isMatch = true;
                        }
                        if (isMatch)
                        {
                            issuances.Add(issuedTokensHeader.TokenIssuances[k]);
                        }
                    }
                }
            }
            return(issuances);
        }