internal void Copy(IssuedTokenParametersElement source)
 {
     if (this.IsReadOnly())
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigReadOnly")));
     }
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     foreach (XmlElementElement element in source.AdditionalRequestParameters)
     {
         XmlElementElement element2 = new XmlElementElement();
         element2.Copy(element);
         this.AdditionalRequestParameters.Add(element2);
     }
     foreach (ClaimTypeElement element3 in source.ClaimTypeRequirements)
     {
         this.ClaimTypeRequirements.Add(new ClaimTypeElement(element3.ClaimType, element3.IsOptional));
     }
     this.KeySize   = source.KeySize;
     this.KeyType   = source.KeyType;
     this.TokenType = source.TokenType;
     this.DefaultMessageSecurityVersion = source.DefaultMessageSecurityVersion;
     if (source.ElementInformation.Properties["issuer"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Issuer.Copy(source.Issuer);
     }
     if (source.ElementInformation.Properties["issuerMetadata"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.IssuerMetadata.Copy(source.IssuerMetadata);
     }
 }
 internal void Copy(IssuedTokenParametersElement source)
 {
     if (this.IsReadOnly())
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigReadOnly")));
     }
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     foreach (XmlElementElement element in source.AdditionalRequestParameters)
     {
         XmlElementElement element2 = new XmlElementElement();
         element2.Copy(element);
         this.AdditionalRequestParameters.Add(element2);
     }
     foreach (ClaimTypeElement element3 in source.ClaimTypeRequirements)
     {
         this.ClaimTypeRequirements.Add(new ClaimTypeElement(element3.ClaimType, element3.IsOptional));
     }
     this.KeySize = source.KeySize;
     this.KeyType = source.KeyType;
     this.TokenType = source.TokenType;
     this.DefaultMessageSecurityVersion = source.DefaultMessageSecurityVersion;
     if (source.ElementInformation.Properties["issuer"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Issuer.Copy(source.Issuer);
     }
     if (source.ElementInformation.Properties["issuerMetadata"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.IssuerMetadata.Copy(source.IssuerMetadata);
     }
 }
 protected override void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
 {
     if (sourceElement is IssuedTokenParametersElement)
     {
         IssuedTokenParametersElement element = (IssuedTokenParametersElement)sourceElement;
         this.optionalIssuedTokenParameters = element.optionalIssuedTokenParameters;
     }
     base.Unmerge(sourceElement, parentElement, saveMode);
 }
 internal void InitializeFrom(IssuedSecurityTokenParameters source, bool initializeNestedBindings)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     this.KeyType = source.KeyType;
     if (source.KeySize > 0)
     {
         this.KeySize = source.KeySize;
     }
     this.TokenType = source.TokenType;
     if (source.IssuerAddress != null)
     {
         this.Issuer.InitializeFrom(source.IssuerAddress);
     }
     if (source.DefaultMessageSecurityVersion != null)
     {
         this.DefaultMessageSecurityVersion = source.DefaultMessageSecurityVersion;
     }
     if ((source.IssuerBinding != null) && initializeNestedBindings)
     {
         string str;
         this.Issuer.BindingConfiguration = this.Issuer.Address.ToString();
         BindingsSection.TryAdd(this.Issuer.BindingConfiguration, source.IssuerBinding, out str);
         this.Issuer.Binding = str;
     }
     if (source.IssuerMetadataAddress != null)
     {
         this.IssuerMetadata.InitializeFrom(source.IssuerMetadataAddress);
     }
     foreach (XmlElement element in source.AdditionalRequestParameters)
     {
         this.AdditionalRequestParameters.Add(new XmlElementElement(element));
     }
     foreach (ClaimTypeRequirement requirement in source.ClaimTypeRequirements)
     {
         this.ClaimTypeRequirements.Add(new ClaimTypeElement(requirement.ClaimType, requirement.IsOptional));
     }
     foreach (IssuedSecurityTokenParameters.AlternativeIssuerEndpoint endpoint in source.AlternativeIssuerEndpoints)
     {
         IssuedTokenParametersElement item = new IssuedTokenParametersElement();
         item.Issuer.InitializeFrom(endpoint.IssuerAddress);
         if (initializeNestedBindings)
         {
             string str2;
             item.Issuer.BindingConfiguration = item.Issuer.Address.ToString();
             BindingsSection.TryAdd(item.Issuer.BindingConfiguration, endpoint.IssuerBinding, out str2);
             item.Issuer.Binding = str2;
         }
         this.OptionalIssuedTokenParameters.Add(item);
     }
 }
Exemplo n.º 5
0
        internal void Copy(IssuedTokenParametersElement source)
        {
            if (this.IsReadOnly())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly)));
            }
            if (null == source)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }

            foreach (XmlElementElement xmlElement in source.AdditionalRequestParameters)
            {
                XmlElementElement newElement = new XmlElementElement();
                newElement.Copy(xmlElement);
                this.AdditionalRequestParameters.Add(newElement);
            }

            foreach (ClaimTypeElement c in source.ClaimTypeRequirements)
            {
                this.ClaimTypeRequirements.Add(new ClaimTypeElement(c.ClaimType, c.IsOptional));
            }

            this.KeySize   = source.KeySize;
            this.KeyType   = source.KeyType;
            this.TokenType = source.TokenType;
            this.DefaultMessageSecurityVersion = source.DefaultMessageSecurityVersion;
            this.UseStrTransform = source.UseStrTransform;

            if (PropertyValueOrigin.Default != source.ElementInformation.Properties[ConfigurationStrings.Issuer].ValueOrigin)
            {
                this.Issuer.Copy(source.Issuer);
            }
            if (PropertyValueOrigin.Default != source.ElementInformation.Properties[ConfigurationStrings.IssuerMetadata].ValueOrigin)
            {
                this.IssuerMetadata.Copy(source.IssuerMetadata);
            }
        }
        internal void InitializeFrom(IssuedSecurityTokenParameters source, bool initializeNestedBindings)
        {
            if (null == source)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");

            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.KeyType, source.KeyType);
            if (source.KeySize > 0)
            {
                SetPropertyValueIfNotDefaultValue(ConfigurationStrings.KeySize, source.KeySize);
            }
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TokenType, source.TokenType);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.UseStrTransform, source.UseStrTransform);

            if (source.IssuerAddress != null)
                this.Issuer.InitializeFrom(source.IssuerAddress);

            if (source.DefaultMessageSecurityVersion != null)
                SetPropertyValueIfNotDefaultValue(ConfigurationStrings.DefaultMessageSecurityVersion, source.DefaultMessageSecurityVersion);

            if (source.IssuerBinding != null && initializeNestedBindings)
            {
                this.Issuer.BindingConfiguration = this.Issuer.Address.ToString();
                string bindingSectionName;
                BindingsSection.TryAdd(this.Issuer.BindingConfiguration,
                    source.IssuerBinding,
                    out bindingSectionName);
                this.Issuer.Binding = bindingSectionName;
            }

            if (source.IssuerMetadataAddress != null)
            {
                this.IssuerMetadata.InitializeFrom(source.IssuerMetadataAddress);
            }

            foreach (XmlElement element in source.AdditionalRequestParameters)
            {
                this.AdditionalRequestParameters.Add(new XmlElementElement(element));
            }

            foreach (ClaimTypeRequirement c in source.ClaimTypeRequirements)
            {
                this.ClaimTypeRequirements.Add(new ClaimTypeElement(c.ClaimType, c.IsOptional));
            }

            foreach (IssuedSecurityTokenParameters.AlternativeIssuerEndpoint alternativeIssuer in source.AlternativeIssuerEndpoints)
            {
                IssuedTokenParametersElement element = new IssuedTokenParametersElement();
                element.Issuer.InitializeFrom(alternativeIssuer.IssuerAddress);
                if (initializeNestedBindings)
                {
                    element.Issuer.BindingConfiguration = element.Issuer.Address.ToString();
                    string bindingSectionName;
                    BindingsSection.TryAdd(element.Issuer.BindingConfiguration,
                        alternativeIssuer.IssuerBinding,
                        out bindingSectionName);
                    element.Issuer.Binding = bindingSectionName;
                }
                this.OptionalIssuedTokenParameters.Add(element);
            }
        }
        internal void Copy(IssuedTokenParametersElement source)
        {
            if (this.IsReadOnly())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly)));
            }
            if (null == source)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }

            foreach (XmlElementElement xmlElement in source.AdditionalRequestParameters)
            {
                XmlElementElement newElement = new XmlElementElement();
                newElement.Copy(xmlElement);
                this.AdditionalRequestParameters.Add(newElement);
            }

            foreach (ClaimTypeElement c in source.ClaimTypeRequirements)
            {
                this.ClaimTypeRequirements.Add(new ClaimTypeElement(c.ClaimType, c.IsOptional));
            }

            this.KeySize = source.KeySize;
            this.KeyType = source.KeyType;
            this.TokenType = source.TokenType;
            this.DefaultMessageSecurityVersion = source.DefaultMessageSecurityVersion;
            this.UseStrTransform = source.UseStrTransform;

            if (PropertyValueOrigin.Default != source.ElementInformation.Properties[ConfigurationStrings.Issuer].ValueOrigin)
            {
                this.Issuer.Copy(source.Issuer);
            }
            if (PropertyValueOrigin.Default != source.ElementInformation.Properties[ConfigurationStrings.IssuerMetadata].ValueOrigin)
            {
                this.IssuerMetadata.Copy(source.IssuerMetadata);
            }
        }
 internal void InitializeFrom(IssuedSecurityTokenParameters source, bool initializeNestedBindings)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     this.KeyType = source.KeyType;
     if (source.KeySize > 0)
     {
         this.KeySize = source.KeySize;
     }
     this.TokenType = source.TokenType;
     if (source.IssuerAddress != null)
     {
         this.Issuer.InitializeFrom(source.IssuerAddress);
     }
     if (source.DefaultMessageSecurityVersion != null)
     {
         this.DefaultMessageSecurityVersion = source.DefaultMessageSecurityVersion;
     }
     if ((source.IssuerBinding != null) && initializeNestedBindings)
     {
         string str;
         this.Issuer.BindingConfiguration = this.Issuer.Address.ToString();
         BindingsSection.TryAdd(this.Issuer.BindingConfiguration, source.IssuerBinding, out str);
         this.Issuer.Binding = str;
     }
     if (source.IssuerMetadataAddress != null)
     {
         this.IssuerMetadata.InitializeFrom(source.IssuerMetadataAddress);
     }
     foreach (XmlElement element in source.AdditionalRequestParameters)
     {
         this.AdditionalRequestParameters.Add(new XmlElementElement(element));
     }
     foreach (ClaimTypeRequirement requirement in source.ClaimTypeRequirements)
     {
         this.ClaimTypeRequirements.Add(new ClaimTypeElement(requirement.ClaimType, requirement.IsOptional));
     }
     foreach (IssuedSecurityTokenParameters.AlternativeIssuerEndpoint endpoint in source.AlternativeIssuerEndpoints)
     {
         IssuedTokenParametersElement item = new IssuedTokenParametersElement();
         item.Issuer.InitializeFrom(endpoint.IssuerAddress);
         if (initializeNestedBindings)
         {
             string str2;
             item.Issuer.BindingConfiguration = item.Issuer.Address.ToString();
             BindingsSection.TryAdd(item.Issuer.BindingConfiguration, endpoint.IssuerBinding, out str2);
             item.Issuer.Binding = str2;
         }
         this.OptionalIssuedTokenParameters.Add(item);
     }
 }
Exemplo n.º 9
0
        internal void InitializeFrom(IssuedSecurityTokenParameters source, bool initializeNestedBindings)
        {
            if (null == source)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }

            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.KeyType, source.KeyType);
            if (source.KeySize > 0)
            {
                SetPropertyValueIfNotDefaultValue(ConfigurationStrings.KeySize, source.KeySize);
            }
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TokenType, source.TokenType);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.UseStrTransform, source.UseStrTransform);

            if (source.IssuerAddress != null)
            {
                this.Issuer.InitializeFrom(source.IssuerAddress);
            }

            if (source.DefaultMessageSecurityVersion != null)
            {
                SetPropertyValueIfNotDefaultValue(ConfigurationStrings.DefaultMessageSecurityVersion, source.DefaultMessageSecurityVersion);
            }

            if (source.IssuerBinding != null && initializeNestedBindings)
            {
                this.Issuer.BindingConfiguration = this.Issuer.Address.ToString();
                string bindingSectionName;
                BindingsSection.TryAdd(this.Issuer.BindingConfiguration,
                                       source.IssuerBinding,
                                       out bindingSectionName);
                this.Issuer.Binding = bindingSectionName;
            }

            if (source.IssuerMetadataAddress != null)
            {
                this.IssuerMetadata.InitializeFrom(source.IssuerMetadataAddress);
            }

            foreach (XmlElement element in source.AdditionalRequestParameters)
            {
                this.AdditionalRequestParameters.Add(new XmlElementElement(element));
            }

            foreach (ClaimTypeRequirement c in source.ClaimTypeRequirements)
            {
                this.ClaimTypeRequirements.Add(new ClaimTypeElement(c.ClaimType, c.IsOptional));
            }

            foreach (IssuedSecurityTokenParameters.AlternativeIssuerEndpoint alternativeIssuer in source.AlternativeIssuerEndpoints)
            {
                IssuedTokenParametersElement element = new IssuedTokenParametersElement();
                element.Issuer.InitializeFrom(alternativeIssuer.IssuerAddress);
                if (initializeNestedBindings)
                {
                    element.Issuer.BindingConfiguration = element.Issuer.Address.ToString();
                    string bindingSectionName;
                    BindingsSection.TryAdd(element.Issuer.BindingConfiguration,
                                           alternativeIssuer.IssuerBinding,
                                           out bindingSectionName);
                    element.Issuer.Binding = bindingSectionName;
                }
                this.OptionalIssuedTokenParameters.Add(element);
            }
        }