public static SecurityToken End(IAsyncResult result) { if (result == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result"); } SecurityTokenProvider.SecurityTokenAsyncResult result2 = result as SecurityTokenProvider.SecurityTokenAsyncResult; if (result2 == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.IdentityModel.SR.GetString("InvalidAsyncResult"), "result")); } return(result2.token); }
public static SecurityToken End(IAsyncResult result) { if (result == null) { throw new ArgumentNullException("result"); } SecurityTokenProvider.SecurityTokenAsyncResult tokenAsyncResult = result as SecurityTokenProvider.SecurityTokenAsyncResult; if (tokenAsyncResult == null) { throw new ArgumentException("InvalidAsyncResult"); } return(tokenAsyncResult.token); }
bool AddSupportingTokens() { while (this.currentTokenProviderIndex < supportingTokenProviders.Count) { SupportingTokenProviderSpecification spec = supportingTokenProviders[this.currentTokenProviderIndex]; IAsyncResult result = null; if ((this.binding is TransportSecurityProtocol) && (spec.TokenParameters is KerberosSecurityTokenParameters)) { result = new SecurityTokenProvider.SecurityTokenAsyncResult(new ProviderBackedSecurityToken(spec.TokenProvider, timeoutHelper.RemainingTime()), null, this); } else { result = spec.TokenProvider.BeginGetToken(timeoutHelper.RemainingTime(), getSupportingTokensCallback, this); } if (!result.CompletedSynchronously) { return false; } this.AddSupportingToken(result); } this.binding.AddMessageSupportingTokens(message, ref this.supportingTokens); return this.OnGetSupportingTokensDone(timeoutHelper.RemainingTime()); }