Esempio n. 1
0
        public void Copy(IssuedTokenServiceElement from)
        {
            if (this.IsReadOnly())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly)));
            }
            if (null == from)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from");
            }
            this.SamlSerializerType = from.SamlSerializerType;
            PropertyInformationCollection propertyInfo = from.ElementInformation.Properties;

            if (propertyInfo[ConfigurationStrings.KnownCertificates].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.KnownCertificates.Clear();
                foreach (X509CertificateTrustedIssuerElement src in from.KnownCertificates)
                {
                    X509CertificateTrustedIssuerElement copy = new X509CertificateTrustedIssuerElement();
                    copy.Copy(src);
                    this.KnownCertificates.Add(copy);
                }
            }

            if (propertyInfo[ConfigurationStrings.AllowedAudienceUris].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.AllowedAudienceUris.Clear();
                foreach (AllowedAudienceUriElement src in from.AllowedAudienceUris)
                {
                    AllowedAudienceUriElement copy = new AllowedAudienceUriElement();
                    copy.AllowedAudienceUri = src.AllowedAudienceUri;
                    this.AllowedAudienceUris.Add(copy);
                }
            }

            this.AllowUntrustedRsaIssuers  = from.AllowUntrustedRsaIssuers;
            this.CertificateValidationMode = from.CertificateValidationMode;
#if DESKTOP
            this.AudienceUriMode = from.AudienceUriMode;
#endif
            this.CustomCertificateValidatorType = from.CustomCertificateValidatorType;
            this.RevocationMode       = from.RevocationMode;
            this.TrustedStoreLocation = from.TrustedStoreLocation;
        }
        public void Copy(IssuedTokenServiceElement from)
        {
            if (this.IsReadOnly())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigReadOnly")));
            }
            if (from == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from");
            }
            this.SamlSerializerType = from.SamlSerializerType;
            PropertyInformationCollection properties = from.ElementInformation.Properties;

            if (properties["knownCertificates"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.KnownCertificates.Clear();
                foreach (X509CertificateTrustedIssuerElement element in from.KnownCertificates)
                {
                    X509CertificateTrustedIssuerElement element2 = new X509CertificateTrustedIssuerElement();
                    element2.Copy(element);
                    this.KnownCertificates.Add(element2);
                }
            }
            if (properties["allowedAudienceUris"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.AllowedAudienceUris.Clear();
                foreach (AllowedAudienceUriElement element3 in from.AllowedAudienceUris)
                {
                    AllowedAudienceUriElement element4 = new AllowedAudienceUriElement {
                        AllowedAudienceUri = element3.AllowedAudienceUri
                    };
                    this.AllowedAudienceUris.Add(element4);
                }
            }
            this.AllowUntrustedRsaIssuers       = from.AllowUntrustedRsaIssuers;
            this.CertificateValidationMode      = from.CertificateValidationMode;
            this.AudienceUriMode                = from.AudienceUriMode;
            this.CustomCertificateValidatorType = from.CustomCertificateValidatorType;
            this.RevocationMode       = from.RevocationMode;
            this.TrustedStoreLocation = from.TrustedStoreLocation;
        }
 public void Copy(IssuedTokenServiceElement from)
 {
     if (this.IsReadOnly())
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigReadOnly")));
     }
     if (from == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from");
     }
     this.SamlSerializerType = from.SamlSerializerType;
     PropertyInformationCollection properties = from.ElementInformation.Properties;
     if (properties["knownCertificates"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.KnownCertificates.Clear();
         foreach (X509CertificateTrustedIssuerElement element in from.KnownCertificates)
         {
             X509CertificateTrustedIssuerElement element2 = new X509CertificateTrustedIssuerElement();
             element2.Copy(element);
             this.KnownCertificates.Add(element2);
         }
     }
     if (properties["allowedAudienceUris"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.AllowedAudienceUris.Clear();
         foreach (AllowedAudienceUriElement element3 in from.AllowedAudienceUris)
         {
             AllowedAudienceUriElement element4 = new AllowedAudienceUriElement {
                 AllowedAudienceUri = element3.AllowedAudienceUri
             };
             this.AllowedAudienceUris.Add(element4);
         }
     }
     this.AllowUntrustedRsaIssuers = from.AllowUntrustedRsaIssuers;
     this.CertificateValidationMode = from.CertificateValidationMode;
     this.AudienceUriMode = from.AudienceUriMode;
     this.CustomCertificateValidatorType = from.CustomCertificateValidatorType;
     this.RevocationMode = from.RevocationMode;
     this.TrustedStoreLocation = from.TrustedStoreLocation;
 }
        public void Copy(IssuedTokenServiceElement from)
        {
            if (this.IsReadOnly())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly)));
            }
            if (null == from)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from");
            }
            this.SamlSerializerType = from.SamlSerializerType;
#pragma warning suppress 56506 // [....]; ElementInformation is never null.
            PropertyInformationCollection propertyInfo = from.ElementInformation.Properties;
            if (propertyInfo[ConfigurationStrings.KnownCertificates].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.KnownCertificates.Clear();
                foreach (X509CertificateTrustedIssuerElement src in from.KnownCertificates)
                {
                    X509CertificateTrustedIssuerElement copy = new X509CertificateTrustedIssuerElement();
                    copy.Copy(src);
                    this.KnownCertificates.Add(copy);
                }
            }

            if (propertyInfo[ConfigurationStrings.AllowedAudienceUris].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.AllowedAudienceUris.Clear();
                foreach (AllowedAudienceUriElement src in from.AllowedAudienceUris)
                {
                    AllowedAudienceUriElement copy = new AllowedAudienceUriElement();
                    copy.AllowedAudienceUri = src.AllowedAudienceUri;
                    this.AllowedAudienceUris.Add(copy);
                }
            }

            this.AllowUntrustedRsaIssuers = from.AllowUntrustedRsaIssuers;
            this.CertificateValidationMode = from.CertificateValidationMode;
            this.AudienceUriMode = from.AudienceUriMode;
            this.CustomCertificateValidatorType = from.CustomCertificateValidatorType;
            this.RevocationMode = from.RevocationMode;
            this.TrustedStoreLocation = from.TrustedStoreLocation;
        }