internal bool TryGetSupportingTokens(SecurityProtocolFactory factory, EndpointAddress target, Uri via, Message message, TimeSpan timeout, bool isBlockingCall, out IList<SupportingTokenSpecification> supportingTokens)
        {
            if (!factory.ActAsInitiator)
            {
                supportingTokens = null;
                return true;
            }
            if (message == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
            }
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
            supportingTokens = null;
            IList<SupportingTokenProviderSpecification> supportingTokenProviders = this.GetSupportingTokenProviders(message.Headers.Action);
            if (supportingTokenProviders != null && supportingTokenProviders.Count > 0)
            {
                // dont do anything if blocking is not allowed
                if (!isBlockingCall)
                {
                    return false;
                }

                supportingTokens = new Collection<SupportingTokenSpecification>();
                for (int i = 0; i < supportingTokenProviders.Count; ++i)
                {
                    SupportingTokenProviderSpecification spec = supportingTokenProviders[i];
                    SecurityToken supportingToken;
                    // The ProviderBackedSecurityToken was added in Win7 to allow KerberosRequestorSecurity 
                    // to pass a channel binding to InitializeSecurityContext.
                    if ((this is TransportSecurityProtocol) && (spec.TokenParameters is KerberosSecurityTokenParameters))
                    {
                        supportingToken = new ProviderBackedSecurityToken(spec.TokenProvider, timeoutHelper.RemainingTime());
                    }
                    else
                    {
                        supportingToken = spec.TokenProvider.GetToken(timeoutHelper.RemainingTime());
                    }

                    supportingTokens.Add(new SupportingTokenSpecification(supportingToken, EmptyReadOnlyCollection<IAuthorizationPolicy>.Instance, spec.SecurityTokenAttachmentMode, spec.TokenParameters));
                }
            }
            // add any runtime supporting tokens
            AddMessageSupportingTokens(message, ref supportingTokens);

            return true;
        }
 internal bool TryGetSupportingTokens(System.ServiceModel.Security.SecurityProtocolFactory factory, EndpointAddress target, Uri via, Message message, TimeSpan timeout, bool isBlockingCall, out IList<SupportingTokenSpecification> supportingTokens)
 {
     if (!factory.ActAsInitiator)
     {
         supportingTokens = null;
         return true;
     }
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
     }
     TimeoutHelper helper = new TimeoutHelper(timeout);
     supportingTokens = null;
     IList<SupportingTokenProviderSpecification> supportingTokenProviders = this.GetSupportingTokenProviders(message.Headers.Action);
     if ((supportingTokenProviders != null) && (supportingTokenProviders.Count > 0))
     {
         if (!isBlockingCall)
         {
             return false;
         }
         supportingTokens = new Collection<SupportingTokenSpecification>();
         for (int i = 0; i < supportingTokenProviders.Count; i++)
         {
             SecurityToken token;
             SupportingTokenProviderSpecification specification = supportingTokenProviders[i];
             if ((this is TransportSecurityProtocol) && (specification.TokenParameters is KerberosSecurityTokenParameters))
             {
                 token = new ProviderBackedSecurityToken(specification.TokenProvider, helper.RemainingTime());
             }
             else
             {
                 token = specification.TokenProvider.GetToken(helper.RemainingTime());
             }
             supportingTokens.Add(new SupportingTokenSpecification(token, EmptyReadOnlyCollection<IAuthorizationPolicy>.Instance, specification.SecurityTokenAttachmentMode, specification.TokenParameters));
         }
     }
     this.AddMessageSupportingTokens(message, ref supportingTokens);
     return true;
 }