Esempio n. 1
0
 protected override IAsyncResult BeginGetTokenCore(TimeSpan timeout, AsyncCallback callback, object state)
 {
     base.CommunicationObject.ThrowIfClosedOrNotOpen();
     lock (this.ThisLock)
     {
         SecurityToken currentServiceToken = this.GetCurrentServiceToken();
         if (currentServiceToken != null)
         {
             SecurityTraceRecordHelper.TraceUsingCachedServiceToken <T>((IssuanceTokenProviderBase <T>) this, currentServiceToken, this.targetAddress);
             return(new CompletedAsyncResult <SecurityToken>(currentServiceToken, callback, state));
         }
         return(this.BeginNegotiation(timeout, callback, state));
     }
 }
        protected override SecurityToken GetTokenCore(TimeSpan timeout)
        {
            this.CommunicationObject.ThrowIfClosedOrNotOpen();
            SecurityToken result;

            lock (ThisLock)
            {
                result = GetCurrentServiceToken();
                if (result != null)
                {
                    SecurityTraceRecordHelper.TraceUsingCachedServiceToken(this, result, this.targetAddress);
                }
            }
            if (result == null)
            {
                result = DoNegotiation(timeout);
            }
            return(result);
        }
Esempio n. 3
0
        protected override SecurityToken GetTokenCore(TimeSpan timeout)
        {
            SecurityToken currentServiceToken;

            base.CommunicationObject.ThrowIfClosedOrNotOpen();
            lock (this.ThisLock)
            {
                currentServiceToken = this.GetCurrentServiceToken();
                if (currentServiceToken != null)
                {
                    SecurityTraceRecordHelper.TraceUsingCachedServiceToken <T>((IssuanceTokenProviderBase <T>) this, currentServiceToken, this.targetAddress);
                }
            }
            if (currentServiceToken == null)
            {
                currentServiceToken = this.DoNegotiation(timeout);
            }
            return(currentServiceToken);
        }
        protected override IAsyncResult BeginGetTokenCore(TimeSpan timeout, AsyncCallback callback, object state)
        {
            this.CommunicationObject.ThrowIfClosedOrNotOpen();
            IAsyncResult asyncResult;

            lock (ThisLock)
            {
                SecurityToken token = GetCurrentServiceToken();
                if (token != null)
                {
                    SecurityTraceRecordHelper.TraceUsingCachedServiceToken(this, token, this.targetAddress);
                    asyncResult = new CompletedAsyncResult <SecurityToken>(token, callback, state);
                }
                else
                {
                    asyncResult = BeginNegotiation(timeout, callback, state);
                }
            }
            return(asyncResult);
        }