Пример #1
0
            void AddSupportingToken(IAsyncResult result)
            {
                SupportingTokenProviderSpecification spec = supportingTokenProviders[this.currentTokenProviderIndex];

                SecurityTokenProvider.SecurityTokenAsyncResult securityTokenAsyncResult = result as SecurityTokenProvider.SecurityTokenAsyncResult;
                if (securityTokenAsyncResult != null)
                {
                    this.supportingTokens.Add(new SupportingTokenSpecification(SecurityTokenProvider.SecurityTokenAsyncResult.End(result), EmptyReadOnlyCollection <IAuthorizationPolicy> .Instance, spec.SecurityTokenAttachmentMode, spec.TokenParameters));
                }
                else
                {
                    this.supportingTokens.Add(new SupportingTokenSpecification(spec.TokenProvider.EndGetToken(result), EmptyReadOnlyCollection <IAuthorizationPolicy> .Instance, spec.SecurityTokenAttachmentMode, spec.TokenParameters));
                }

                ++this.currentTokenProviderIndex;
            }
 private bool AddSupportingTokens()
 {
     while (this.currentTokenProviderIndex < this.supportingTokenProviders.Count)
     {
         SupportingTokenProviderSpecification specification = this.supportingTokenProviders[this.currentTokenProviderIndex];
         IAsyncResult result = null;
         if ((this.binding is TransportSecurityProtocol) && (specification.TokenParameters is KerberosSecurityTokenParameters))
         {
             result = new SecurityTokenProvider.SecurityTokenAsyncResult(new ProviderBackedSecurityToken(specification.TokenProvider, this.timeoutHelper.RemainingTime()), null, this);
         }
         else
         {
             result = specification.TokenProvider.BeginGetToken(this.timeoutHelper.RemainingTime(), getSupportingTokensCallback, this);
         }
         if (!result.CompletedSynchronously)
         {
             return(false);
         }
         this.AddSupportingToken(result);
     }
     this.binding.AddMessageSupportingTokens(this.message, ref this.supportingTokens);
     return(this.OnGetSupportingTokensDone(this.timeoutHelper.RemainingTime()));
 }