Пример #1
0
 public ServiceCredentials()
 {
     UserNameAuthentication           = new UserNamePasswordServiceCredential();
     ClientCertificate                = new X509CertificateInitiatorServiceCredential();
     ServiceCertificate               = new X509CertificateRecipientServiceCredential();
     WindowsAuthentication            = new WindowsServiceCredential();
     IssuedTokenAuthentication        = new IssuedTokenServiceCredential();
     SecureConversationAuthentication = new SecureConversationServiceCredential();
     _exceptionMapper = new ExceptionMapper();
 }
Пример #2
0
 public ServiceCredentials()
 {
     userName                = new UserNamePasswordServiceCredential();
     clientCertificate       = new X509CertificateInitiatorServiceCredential();
     serviceCertificate      = new X509CertificateRecipientServiceCredential();
     windows                 = new WindowsServiceCredential();
     this.issuedToken        = new IssuedTokenServiceCredential();
     this.secureConversation = new SecureConversationServiceCredential();
     exceptionMapper         = new ExceptionMapper();
 }
 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();
 }
Пример #4
0
        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 type = System.Type.GetType(this.CustomCertificateValidatorType, true);
                if (!typeof(X509CertificateValidator).IsAssignableFrom(type))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
                                                                                  SR.GetString(SR.ConfigInvalidCertificateValidatorType, this.CustomCertificateValidatorType, typeof(X509CertificateValidator).ToString())));
                }
                issuedToken.CustomCertificateValidator = (X509CertificateValidator)Activator.CreateInstance(type);
            }
            if (!string.IsNullOrEmpty(this.SamlSerializerType))
            {
                Type type = System.Type.GetType(this.SamlSerializerType, true);
                if (!typeof(SamlSerializer).IsAssignableFrom(type))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
                                                                                  SR.GetString(SR.ConfigInvalidSamlSerializerType, this.SamlSerializerType, typeof(SamlSerializer).ToString())));
                }
                issuedToken.SamlSerializer = (SamlSerializer)Activator.CreateInstance(type);
            }
            PropertyInformationCollection propertyInfo = this.ElementInformation.Properties;

            if (propertyInfo[ConfigurationStrings.KnownCertificates].ValueOrigin != PropertyValueOrigin.Default)
            {
                foreach (X509CertificateTrustedIssuerElement src in this.KnownCertificates)
                {
                    issuedToken.KnownCertificates.Add(SecurityUtils.GetCertificateFromStore(src.StoreName, src.StoreLocation, src.X509FindType, src.FindValue, null));
                }
            }

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

            issuedToken.AllowUntrustedRsaIssuers = this.AllowUntrustedRsaIssuers;
        }
 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);
 }
Пример #6
0
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(other));
     }
     UserNameAuthentication           = new UserNamePasswordServiceCredential(other.UserNameAuthentication);
     ClientCertificate                = new X509CertificateInitiatorServiceCredential(other.ClientCertificate);
     ServiceCertificate               = new X509CertificateRecipientServiceCredential(other.ServiceCertificate);
     WindowsAuthentication            = new WindowsServiceCredential(other.WindowsAuthentication);
     IssuedTokenAuthentication        = new IssuedTokenServiceCredential(other.IssuedTokenAuthentication);
     SecureConversationAuthentication = new SecureConversationServiceCredential(other.SecureConversationAuthentication);
     _saveBootstrapTokenInSession     = other._saveBootstrapTokenInSession;
     _exceptionMapper = other._exceptionMapper;
 }
Пример #7
0
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(other));
     }
     userName                    = new UserNamePasswordServiceCredential(other.userName);
     clientCertificate           = new X509CertificateInitiatorServiceCredential(other.clientCertificate);
     serviceCertificate          = new X509CertificateRecipientServiceCredential(other.serviceCertificate);
     windows                     = new WindowsServiceCredential(other.windows);
     this.issuedToken            = new IssuedTokenServiceCredential(other.issuedToken);
     this.secureConversation     = new SecureConversationServiceCredential(other.secureConversation);
     saveBootstrapTokenInSession = other.saveBootstrapTokenInSession;
     exceptionMapper             = other.exceptionMapper;
 }