private static void FindInfoCardIssuerBinding(SecurityBindingElement secBindingElement, ThrowOnMultipleAssignment <IssuedSecurityTokenParameters> issuedSecurityTokenParameters)
 {
     if (secBindingElement != null)
     {
         SecurityTokenParametersEnumerable enumerable = new SecurityTokenParametersEnumerable(secBindingElement);
         foreach (SecurityTokenParameters parameters in enumerable)
         {
             IssuedSecurityTokenParameters parameters2 = parameters as IssuedSecurityTokenParameters;
             if ((parameters2 != null) && (((parameters2.IssuerBinding == null) || (parameters2.IssuerAddress == null)) || ((parameters2.IssuerAddress.IsAnonymous || SelfIssuerUri.Equals(parameters2.IssuerAddress)) || IsReferralToManagedIssuer(parameters2.IssuerBinding))))
             {
                 if (issuedSecurityTokenParameters != null)
                 {
                     issuedSecurityTokenParameters.Value = parameters2;
                 }
             }
             else if (parameters is SecureConversationSecurityTokenParameters)
             {
                 IssuedSecurityTokenParameters parameters3 = TryGetNextStsIssuedTokenParameters(((SecureConversationSecurityTokenParameters)parameters).BootstrapSecurityBindingElement);
                 if ((parameters3 != null) && (issuedSecurityTokenParameters != null))
                 {
                     issuedSecurityTokenParameters.Value = parameters3;
                 }
             }
             else if (((parameters2 != null) && (parameters2.IssuerBinding != null)) && ((TryGetNextStsIssuedTokenParameters(parameters2.IssuerBinding.CreateBindingElements().Find <SecurityBindingElement>()) != null) && (issuedSecurityTokenParameters != null)))
             {
                 issuedSecurityTokenParameters.Value = parameters2;
             }
         }
     }
 }
Пример #2
0
        static void FindInfoCardIssuerBinding(SecurityBindingElement secBindingElement, ThrowOnMultipleAssignment <IssuedSecurityTokenParameters> issuedSecurityTokenParameters)
        {
            if (secBindingElement == null)
            {
                return;
            }

            //
            // Go down the list of possible places for an IssuedSecurityTokenParameters, and hope we don't
            // miss anything.
            //
            SecurityTokenParametersEnumerable tokenParamEnumerator = new SecurityTokenParametersEnumerable(secBindingElement);

            foreach (SecurityTokenParameters param in tokenParamEnumerator)
            {
                IssuedSecurityTokenParameters issuedTokenParam = param as IssuedSecurityTokenParameters;
                if (issuedTokenParam != null &&
                    ((issuedTokenParam.IssuerBinding == null ||
                      issuedTokenParam.IssuerAddress == null ||
                      issuedTokenParam.IssuerAddress.IsAnonymous ||
                      SelfIssuerUri.Equals(issuedTokenParam.IssuerAddress)) ||
                     (IsReferralToManagedIssuer(issuedTokenParam.IssuerBinding))))
                {
                    if (issuedSecurityTokenParameters != null)
                    {
                        issuedSecurityTokenParameters.Value = issuedTokenParam;
                    }
                }
                else if (param is SecureConversationSecurityTokenParameters)
                {
                    IssuedSecurityTokenParameters istp = TryGetNextStsIssuedTokenParameters(((SecureConversationSecurityTokenParameters)param).BootstrapSecurityBindingElement);
                    if ((istp != null) && (issuedSecurityTokenParameters != null))
                    {
                        issuedSecurityTokenParameters.Value = istp;
                    }
                }
                else if ((issuedTokenParam != null) && (issuedTokenParam.IssuerBinding != null))
                {
                    BindingElementCollection      bindingElements             = issuedTokenParam.IssuerBinding.CreateBindingElements();
                    SecurityBindingElement        innerSecurityBindingElement = bindingElements.Find <SecurityBindingElement>();
                    IssuedSecurityTokenParameters istp = TryGetNextStsIssuedTokenParameters(innerSecurityBindingElement);
                    if ((istp != null) && (issuedSecurityTokenParameters != null))
                    {
                        issuedSecurityTokenParameters.Value = issuedTokenParam;
                    }
                }
            }
        }