Esempio n. 1
0
 internal IssuedTokenClientCredential(IssuedTokenClientCredential other)
 {
     this.defaultKeyEntropyMode                 = SecurityKeyEntropyMode.CombinedEntropy;
     this.cacheIssuedTokens                     = true;
     this.maxIssuedTokenCachingTime             = IssuanceTokenProviderBase <SspiNegotiationTokenProviderState> .DefaultClientMaxTokenCachingTime;
     this.issuedTokenRenewalThresholdPercentage = 60;
     this.defaultKeyEntropyMode                 = other.defaultKeyEntropyMode;
     this.cacheIssuedTokens                     = other.cacheIssuedTokens;
     this.issuedTokenRenewalThresholdPercentage = other.issuedTokenRenewalThresholdPercentage;
     this.maxIssuedTokenCachingTime             = other.maxIssuedTokenCachingTime;
     this.localIssuerAddress                    = other.localIssuerAddress;
     this.localIssuerBinding                    = (other.localIssuerBinding != null) ? new CustomBinding(other.localIssuerBinding) : null;
     if (other.localIssuerChannelBehaviors != null)
     {
         this.localIssuerChannelBehaviors = this.GetBehaviorCollection(other.localIssuerChannelBehaviors);
     }
     if (other.issuerChannelBehaviors != null)
     {
         this.issuerChannelBehaviors = new Dictionary <Uri, KeyedByTypeCollection <IEndpointBehavior> >();
         foreach (Uri uri in other.issuerChannelBehaviors.Keys)
         {
             this.issuerChannelBehaviors.Add(uri, this.GetBehaviorCollection(other.issuerChannelBehaviors[uri]));
         }
     }
     this.isReadOnly = other.isReadOnly;
 }
 internal IssuedTokenClientCredential(IssuedTokenClientCredential other)
 {
     this.defaultKeyEntropyMode = other.defaultKeyEntropyMode;
     this.cacheIssuedTokens = other.cacheIssuedTokens;
     this.issuedTokenRenewalThresholdPercentage = other.issuedTokenRenewalThresholdPercentage;
     this.maxIssuedTokenCachingTime = other.maxIssuedTokenCachingTime;
     this.localIssuerAddress = other.localIssuerAddress;
     this.localIssuerBinding = (other.localIssuerBinding != null) ? new CustomBinding(other.localIssuerBinding) : null;
     if (other.localIssuerChannelBehaviors != null)
         this.localIssuerChannelBehaviors = GetBehaviorCollection(other.localIssuerChannelBehaviors);
     if (other.issuerChannelBehaviors != null)
     {
         this.issuerChannelBehaviors = new Dictionary<Uri, KeyedByTypeCollection<IEndpointBehavior>>();
         foreach (Uri uri in other.issuerChannelBehaviors.Keys)
         {
             this.issuerChannelBehaviors.Add(uri, GetBehaviorCollection(other.issuerChannelBehaviors[uri]));
         }
     }
     this.isReadOnly = other.isReadOnly;
 }
 internal IssuedTokenClientCredential(IssuedTokenClientCredential other)
 {
     this.defaultKeyEntropyMode = other.defaultKeyEntropyMode;
     this.cacheIssuedTokens     = other.cacheIssuedTokens;
     this.issuedTokenRenewalThresholdPercentage = other.issuedTokenRenewalThresholdPercentage;
     this.maxIssuedTokenCachingTime             = other.maxIssuedTokenCachingTime;
     this.localIssuerAddress = other.localIssuerAddress;
     this.localIssuerBinding = (other.localIssuerBinding != null) ? new CustomBinding(other.localIssuerBinding) : null;
     if (other.localIssuerChannelBehaviors != null)
     {
         this.localIssuerChannelBehaviors = GetBehaviorCollection(other.localIssuerChannelBehaviors);
     }
     if (other.issuerChannelBehaviors != null)
     {
         this.issuerChannelBehaviors = new Dictionary <Uri, KeyedByTypeCollection <IEndpointBehavior> >();
         foreach (Uri uri in other.issuerChannelBehaviors.Keys)
         {
             this.issuerChannelBehaviors.Add(uri, GetBehaviorCollection(other.issuerChannelBehaviors[uri]));
         }
     }
     this.isReadOnly = other.isReadOnly;
 }
 internal void ApplyConfiguration(IssuedTokenClientCredential issuedToken)
 {
     if (issuedToken == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuedToken");
     }
     issuedToken.CacheIssuedTokens = this.CacheIssuedTokens;
     issuedToken.DefaultKeyEntropyMode = this.DefaultKeyEntropyMode;
     issuedToken.MaxIssuedTokenCachingTime = this.MaxIssuedTokenCachingTime;
     issuedToken.IssuedTokenRenewalThresholdPercentage = this.IssuedTokenRenewalThresholdPercentage;
     if (base.ElementInformation.Properties["localIssuer"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.LocalIssuer.Validate();
         issuedToken.LocalIssuerAddress = ConfigLoader.LoadEndpointAddress(this.LocalIssuer);
         if (!string.IsNullOrEmpty(this.LocalIssuer.Binding))
         {
             issuedToken.LocalIssuerBinding = ConfigLoader.LookupBinding(this.LocalIssuer.Binding, this.LocalIssuer.BindingConfiguration, base.EvaluationContext);
         }
     }
     if (!string.IsNullOrEmpty(this.LocalIssuerChannelBehaviors))
     {
         ConfigLoader.LoadChannelBehaviors(this.LocalIssuerChannelBehaviors, base.EvaluationContext, issuedToken.LocalIssuerChannelBehaviors);
     }
     if (base.ElementInformation.Properties["issuerChannelBehaviors"].ValueOrigin != PropertyValueOrigin.Default)
     {
         foreach (IssuedTokenClientBehaviorsElement element in this.IssuerChannelBehaviors)
         {
             if (!string.IsNullOrEmpty(element.BehaviorConfiguration))
             {
                 KeyedByTypeCollection<IEndpointBehavior> channelBehaviors = new KeyedByTypeCollection<IEndpointBehavior>();
                 ConfigLoader.LoadChannelBehaviors(element.BehaviorConfiguration, base.EvaluationContext, channelBehaviors);
                 issuedToken.IssuerChannelBehaviors.Add(new Uri(element.IssuerAddress), channelBehaviors);
             }
         }
     }
 }
        protected ClientCredentials(ClientCredentials other)
        {
            if (other == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
            if (other.userName != null)
                this.userName = new UserNamePasswordClientCredential(other.userName);
            if (other.clientCertificate != null)
                this.clientCertificate = new X509CertificateInitiatorClientCredential(other.clientCertificate);
            if (other.serviceCertificate != null)
                this.serviceCertificate = new X509CertificateRecipientClientCredential(other.serviceCertificate);
            if (other.windows != null)
                this.windows = new WindowsClientCredential(other.windows);
            if (other.httpDigest != null)
                this.httpDigest = new HttpDigestClientCredential(other.httpDigest);
            if (other.issuedToken != null)
                this.issuedToken = new IssuedTokenClientCredential(other.issuedToken);
            if (other.peer != null)
                this.peer = new PeerCredential(other.peer);

            this.getInfoCardTokenCallback = other.getInfoCardTokenCallback;
            this.supportInteractive = other.supportInteractive;
            this.securityTokenHandlerCollectionManager = other.securityTokenHandlerCollectionManager;
            this.useIdentityConfiguration = other.useIdentityConfiguration;
            this.isReadOnly = other.isReadOnly;
        }