protected ClientCredentials(ClientCredentials other) { if (other == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other"); } if (other._userName != null) { _userName = new UserNamePasswordClientCredential(other._userName); } if (other._clientCertificate != null) { _clientCertificate = new X509CertificateInitiatorClientCredential(other._clientCertificate); } if (other._serviceCertificate != null) { _serviceCertificate = new X509CertificateRecipientClientCredential(other._serviceCertificate); } if (other._windows != null) { _windows = new WindowsClientCredential(other._windows); } if (other._httpDigest != null) { _httpDigest = new HttpDigestClientCredential(other._httpDigest); } _isReadOnly = other._isReadOnly; }
private async Task <RegiXResponse> CallRegiXAsync(CustomCallContext context, ServiceRequestData request) { try { RegiXEntryPointClient client = CreateRegiXEntryPointClient(); // Ако не е подаден сертификат, се използва този от конфигурационния файл. X509CertificateInitiatorClientCredential clientCert = client.ClientCredentials.ClientCertificate; if (context.Certificate != null) { clientCert.Certificate = context.Certificate; } else if (clientCert.Certificate == null) { throw new Exception("Не е указан сертификат за достъп до RegiX."); } Log.Information($"IntegrationService/CallRegiXAsync - certificate thumbprint: {clientCert.Certificate?.Thumbprint}"); RegiXResponse response = await RegiXUtility.CallAsync(client, request); return(response); } catch (Exception ex) { throw ex; } }
private void ApplyClientCertificateSettings() { if (ClientCertificates.Count > 0) { bool foundCertificate = false; var firstCertificate = ClientCertificates[0]; _rtFilter.ClientCertificate = X509CertificateInitiatorClientCredential.TryGetUapCertificate(firstCertificate, out foundCertificate); Contract.Assert(foundCertificate, "We shouldn't be able to have an X509Certificate2 which doesn't have an attached UWP Certificate"); } }
public void ClientCertificate() { ClientCredentials c = new ClientCredentials(); Assert.AreEqual(true, c.SupportInteractive, "#1"); X509CertificateInitiatorClientCredential ccert = c.ClientCertificate; Assert.IsNull(ccert.Certificate, "#2"); }
private static void ValidateClientCertificate(X509Certificate2 certificate) { #if FEATURE_NETNATIVE bool found; X509CertificateInitiatorClientCredential.TryGetUapCertificate(certificate, out found); if (!found) { throw ExceptionHelper.PlatformNotSupported("Directly setting the Certificate is not supported for HTTP yet. Use X509CertificateInitiatorClientCredential.SetCertificate instead"); } #endif // FEATURE_NETNATIVE }
internal void ApplyConfiguration(X509CertificateInitiatorClientCredential cert) { if (cert == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("cert"); } PropertyInformationCollection properties = base.ElementInformation.Properties; if (((properties["storeLocation"].ValueOrigin != PropertyValueOrigin.Default) || (properties["storeName"].ValueOrigin != PropertyValueOrigin.Default)) || ((properties["x509FindType"].ValueOrigin != PropertyValueOrigin.Default) || (properties["findValue"].ValueOrigin != PropertyValueOrigin.Default))) { cert.SetCertificate(this.StoreLocation, this.StoreName, this.X509FindType, this.FindValue); } }
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; }