示例#1
0
        /// <summary>
        /// Extensibility point for serving up the WSTrustChannelSecurityTokenManager
        /// </summary>
        /// <returns>WSTrustChannelSecurityTokenManager</returns>
        public override SecurityTokenManager CreateSecurityTokenManager()
        {
            if (ClientCredentials != null)
            {
                SecurityTokenManager = ClientCredentials.CreateSecurityTokenManager();
            }

            return(new WSTrustChannelSecurityTokenManager((WSTrustChannelClientCredentials)Clone()));
        }
    public static void Derivable()
    {
        var credentials = new ClientCredentials();

        Assert.NotNull(credentials);
        Assert.IsAssignableFrom <SecurityCredentialsManager>(credentials);

        SecurityTokenManager tokenManager = credentials.CreateSecurityTokenManager();

        Assert.NotNull(tokenManager);
    }
        void CallBegin(bool completedSynchronously)
        {
            IAsyncResult result    = null;
            Exception    exception = null;

            try
            {
                CardSpacePolicyElement[] chain;
                SecurityTokenManager     tokenManager = credentials.CreateSecurityTokenManager();
                requiresInfoCard = InfoCardHelper.IsInfocardRequired(binding, credentials, tokenManager, proxy.RemoteAddress, out chain, out relyingPartyIssuer);
                MessageSecurityVersion    bindingSecurityVersion = InfoCardHelper.GetBindingSecurityVersionOrDefault(binding);
                WSSecurityTokenSerializer tokenSerializer        = WSSecurityTokenSerializer.DefaultInstance;
                result = credentials.GetInfoCardTokenCallback.BeginInvoke(requiresInfoCard, chain, tokenManager.CreateSecurityTokenSerializer(bindingSecurityVersion.SecurityTokenVersion), callback, this);
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }

                exception = e;
            }
            if (exception == null)
            {
                if (!result.CompletedSynchronously)
                {
                    return;
                }

                this.CallEnd(result, out exception);
            }
            if (exception != null)
            {
                return;
            }


            this.CallComplete(completedSynchronously, null);
        }