public ServiceCredentials()
 {
     this.userName = new UserNamePasswordServiceCredential();
     this.clientCertificate = new X509CertificateInitiatorServiceCredential();
     this.serviceCertificate = new X509CertificateRecipientServiceCredential();
     this.windows = new WindowsServiceCredential();
     this.issuedToken = new IssuedTokenServiceCredential();
     this.peer = new PeerCredential();
     this.secureConversation = new SecureConversationServiceCredential();
 }
 internal IssuedTokenServiceCredential(IssuedTokenServiceCredential other)
 {
     this.audienceUriMode = other.audienceUriMode;
     this.allowedAudienceUris = new List<string>(other.allowedAudienceUris);
     this.samlSerializer = other.samlSerializer;
     this.knownCertificates = new List<X509Certificate2>(other.knownCertificates);
     this.certificateValidationMode = other.certificateValidationMode;
     this.customCertificateValidator = other.customCertificateValidator;
     this.trustedStoreLocation = other.trustedStoreLocation;
     this.revocationMode = other.revocationMode;
     this.allowUntrustedRsaIssuers = other.allowUntrustedRsaIssuers;
     this.isReadOnly = other.isReadOnly;
 }
예제 #3
0
 internal IssuedTokenServiceCredential(IssuedTokenServiceCredential other)
 {
     this.audienceUriMode            = other.audienceUriMode;
     this.allowedAudienceUris        = new List <string>(other.allowedAudienceUris);
     this.samlSerializer             = other.samlSerializer;
     this.knownCertificates          = new List <X509Certificate2>(other.knownCertificates);
     this.certificateValidationMode  = other.certificateValidationMode;
     this.customCertificateValidator = other.customCertificateValidator;
     this.trustedStoreLocation       = other.trustedStoreLocation;
     this.revocationMode             = other.revocationMode;
     this.allowUntrustedRsaIssuers   = other.allowUntrustedRsaIssuers;
     this.isReadOnly = other.isReadOnly;
 }
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
     }
     this.userName = new UserNamePasswordServiceCredential(other.userName);
     this.clientCertificate = new X509CertificateInitiatorServiceCredential(other.clientCertificate);
     this.serviceCertificate = new X509CertificateRecipientServiceCredential(other.serviceCertificate);
     this.windows = new WindowsServiceCredential(other.windows);
     this.issuedToken = new IssuedTokenServiceCredential(other.issuedToken);
     this.peer = new PeerCredential(other.peer);
     this.secureConversation = new SecureConversationServiceCredential(other.secureConversation);
 }
 internal IssuedTokenServiceCredential(IssuedTokenServiceCredential other)
 {
     this.audienceUriMode            = System.IdentityModel.Selectors.AudienceUriMode.Always;
     this.certificateValidationMode  = X509CertificateValidationMode.ChainTrust;
     this.revocationMode             = X509RevocationMode.Online;
     this.trustedStoreLocation       = StoreLocation.LocalMachine;
     this.audienceUriMode            = other.audienceUriMode;
     this.allowedAudienceUris        = new List <string>(other.allowedAudienceUris);
     this.samlSerializer             = other.samlSerializer;
     this.knownCertificates          = new List <X509Certificate2>(other.knownCertificates);
     this.certificateValidationMode  = other.certificateValidationMode;
     this.customCertificateValidator = other.customCertificateValidator;
     this.trustedStoreLocation       = other.trustedStoreLocation;
     this.revocationMode             = other.revocationMode;
     this.allowUntrustedRsaIssuers   = other.allowUntrustedRsaIssuers;
     this.isReadOnly = other.isReadOnly;
 }
 internal void ApplyConfiguration(IssuedTokenServiceCredential issuedToken)
 {
     if (issuedToken == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuedToken");
     }
     issuedToken.CertificateValidationMode = this.CertificateValidationMode;
     issuedToken.RevocationMode = this.RevocationMode;
     issuedToken.TrustedStoreLocation = this.TrustedStoreLocation;
     issuedToken.AudienceUriMode = this.AudienceUriMode;
     if (!string.IsNullOrEmpty(this.CustomCertificateValidatorType))
     {
         Type c = Type.GetType(this.CustomCertificateValidatorType, true);
         if (!typeof(X509CertificateValidator).IsAssignableFrom(c))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidCertificateValidatorType", new object[] { this.CustomCertificateValidatorType, typeof(X509CertificateValidator).ToString() })));
         }
         issuedToken.CustomCertificateValidator = (X509CertificateValidator) Activator.CreateInstance(c);
     }
     if (!string.IsNullOrEmpty(this.SamlSerializerType))
     {
         Type type = Type.GetType(this.SamlSerializerType, true);
         if (!typeof(SamlSerializer).IsAssignableFrom(type))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidSamlSerializerType", new object[] { this.SamlSerializerType, typeof(SamlSerializer).ToString() })));
         }
         issuedToken.SamlSerializer = (SamlSerializer) Activator.CreateInstance(type);
     }
     PropertyInformationCollection properties = base.ElementInformation.Properties;
     if (properties["knownCertificates"].ValueOrigin != PropertyValueOrigin.Default)
     {
         foreach (X509CertificateTrustedIssuerElement element in this.KnownCertificates)
         {
             issuedToken.KnownCertificates.Add(System.ServiceModel.Security.SecurityUtils.GetCertificateFromStore(element.StoreName, element.StoreLocation, element.X509FindType, element.FindValue, null));
         }
     }
     if (properties["allowedAudienceUris"].ValueOrigin != PropertyValueOrigin.Default)
     {
         foreach (AllowedAudienceUriElement element2 in this.AllowedAudienceUris)
         {
             issuedToken.AllowedAudienceUris.Add(element2.AllowedAudienceUri);
         }
     }
     issuedToken.AllowUntrustedRsaIssuers = this.AllowUntrustedRsaIssuers;
 }