From b284e527b057e8659a0a0a4188357a8189d01c4e Mon Sep 17 00:00:00 2001 From: David Galey Date: Fri, 7 Jun 2024 14:59:56 -0400 Subject: [PATCH 1/3] trace logging of PvOrderRequest object --- .../Client/GlobalSignApiClient.cs | 65 ++++++++++++++++--- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs b/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs index f84dbb0..5257443 100644 --- a/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs +++ b/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs @@ -258,17 +258,64 @@ public EnrollmentResult Enroll(GlobalSignEnrollRequest enrollRequest) using (this.OrderService) { var rawRequest = enrollRequest.Request; - Logger.Trace($"Request details:"); - Logger.Trace($"Profile ID: {rawRequest.MSSLProfileID}"); - Logger.Trace($"Domain ID: {rawRequest.MSSLDomainID}"); - Logger.Trace($"Contact Info: {rawRequest.ContactInfo.FirstName}, {rawRequest.ContactInfo.LastName}, {rawRequest.ContactInfo.Email}, {rawRequest.ContactInfo.Phone}"); - Logger.Trace($"SAN Count: {rawRequest.SANEntries.Count()}"); - if (rawRequest.SANEntries.Count() > 0) + //Logger.Trace($"Request details:"); + //Logger.Trace($"Profile ID: {rawRequest.MSSLProfileID}"); + //Logger.Trace($"Domain ID: {rawRequest.MSSLDomainID}"); + //Logger.Trace($"Contact Info: {rawRequest.ContactInfo.FirstName}, {rawRequest.ContactInfo.LastName}, {rawRequest.ContactInfo.Email}, {rawRequest.ContactInfo.Phone}"); + //Logger.Trace($"SAN Count: {rawRequest.SANEntries.Count()}"); + //if (rawRequest.SANEntries.Count() > 0) + //{ + // Logger.Trace($"SANs: {string.Join(",", rawRequest.SANEntries.Select(s => s.SubjectAltName))}"); + //} + //Logger.Trace($"Product Code: {rawRequest.OrderRequestParameter.ProductCode}"); + //Logger.Trace($"Order Kind: {rawRequest.OrderRequestParameter.OrderKind}"); + + + Logger.Trace($"BmV2PvOrderRequest details:"); + Logger.Trace($"PvOrderRequest.CertificateTemplate.Template: {rawRequest.CertificateTemplate.Template}"); + Logger.Trace($"PvOrderRequest.CertificateTemplate.MajorVersion: {rawRequest.CertificateTemplate.MajorVersion}"); + Logger.Trace($"PvOrderRequest.CertificateTemplate.MinorVersion: {rawRequest.CertificateTemplate.MinorVersion}"); + Logger.Trace($"PvOrderRequest.OrderRequestHeader.AuthToken.Username: {rawRequest.OrderRequestHeader.AuthToken.UserName}"); + Logger.Trace($"PvOrderRequest.OrderRequestHeader.AuthToken.Password: "); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ProductCode: {rawRequest.OrderRequestParameter.ProductCode}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.BaseOption: {rawRequest.OrderRequestParameter.BaseOption}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.OrderKind: {rawRequest.OrderRequestParameter.OrderKind}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Licenses: {rawRequest.OrderRequestParameter.Licenses}"); + foreach (var opt in rawRequest.OrderRequestParameter.Options) + { + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Option[{opt.OptionName}]: {opt.OptionValue}"); + } + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.Months: {rawRequest.OrderRequestParameter.ValidityPeriod.Months}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.NotBefore: {rawRequest.OrderRequestParameter.ValidityPeriod.NotBefore}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.NotAfter: {rawRequest.OrderRequestParameter.ValidityPeriod.NotAfter}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.CSR: {rawRequest.OrderRequestParameter.CSR}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.RenewalTargetOrderID: {rawRequest.OrderRequestParameter.RenewalTargetOrderID}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.TargetCert: {rawRequest.OrderRequestParameter.TargetCERT}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.SpecialInstructions: {rawRequest.OrderRequestParameter.SpecialInstructions}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Coupon: {rawRequest.OrderRequestParameter.Coupon}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Campaign: {rawRequest.OrderRequestParameter.Campaign}"); + Logger.Trace($"PvOrderRequest.MsslProfileId: {rawRequest.MSSLProfileID}"); + Logger.Trace($"PvOrderRequest.MsslDomainId: {rawRequest.MSSLDomainID}"); + Logger.Trace($"PvOrderRequest.SubId: {rawRequest.SubID}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine1: {rawRequest.PVSealInfo.AddressLine1}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine2: {rawRequest.PVSealInfo.AddressLine2}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine3: {rawRequest.PVSealInfo.AddressLine3}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.PostalCode: {rawRequest.PVSealInfo.PostalCode}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.Phone: {rawRequest.PVSealInfo.Phone}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.Fax: {rawRequest.PVSealInfo.Fax}"); + Logger.Trace($"PvOrderRequest.ContactInfo.FirstName: {rawRequest.ContactInfo.FirstName}"); + Logger.Trace($"PvOrderRequest.ContactInfo.LastName: {rawRequest.ContactInfo.LastName}"); + Logger.Trace($"PvOrderRequest.ContactInfo.Phone: {rawRequest.ContactInfo.Phone}"); + Logger.Trace($"PvOrderRequest.ContactInfo.Email: {rawRequest.ContactInfo.Email}"); + foreach (var san in rawRequest.SANEntries) { - Logger.Trace($"SANs: {string.Join(",", rawRequest.SANEntries.Select(s => s.SubjectAltName))}"); + Logger.Trace($"PvOrderRequest.SAN: {san.SubjectAltName}, {san.SANOptionType}"); } - Logger.Trace($"Product Code: {rawRequest.OrderRequestParameter.ProductCode}"); - Logger.Trace($"Order Kind: {rawRequest.OrderRequestParameter.OrderKind}"); + foreach (var ext in rawRequest.Extensions) + { + Logger.Trace($"PvOrderRequest.Extensions[{ext.Name}]: {ext.Value}"); + } + var response = OrderService.PVOrder(enrollRequest.Request); if (response.OrderResponseHeader.SuccessCode == 0) { From e011668e6ee59ab489e7ba2cd85e211149b474ad Mon Sep 17 00:00:00 2001 From: David Galey Date: Thu, 13 Jun 2024 13:43:40 -0400 Subject: [PATCH 2/3] more logging --- .../Client/GlobalSignApiClient.cs | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs b/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs index 5257443..8309066 100644 --- a/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs +++ b/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs @@ -272,41 +272,38 @@ public EnrollmentResult Enroll(GlobalSignEnrollRequest enrollRequest) Logger.Trace($"BmV2PvOrderRequest details:"); - Logger.Trace($"PvOrderRequest.CertificateTemplate.Template: {rawRequest.CertificateTemplate.Template}"); - Logger.Trace($"PvOrderRequest.CertificateTemplate.MajorVersion: {rawRequest.CertificateTemplate.MajorVersion}"); - Logger.Trace($"PvOrderRequest.CertificateTemplate.MinorVersion: {rawRequest.CertificateTemplate.MinorVersion}"); - Logger.Trace($"PvOrderRequest.OrderRequestHeader.AuthToken.Username: {rawRequest.OrderRequestHeader.AuthToken.UserName}"); + Logger.Trace($"PvOrderRequest.OrderRequestHeader.AuthToken.Username: {rawRequest.OrderRequestHeader.AuthToken.UserName ?? string.Empty}"); Logger.Trace($"PvOrderRequest.OrderRequestHeader.AuthToken.Password: "); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.ProductCode: {rawRequest.OrderRequestParameter.ProductCode}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.BaseOption: {rawRequest.OrderRequestParameter.BaseOption}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.OrderKind: {rawRequest.OrderRequestParameter.OrderKind}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.Licenses: {rawRequest.OrderRequestParameter.Licenses}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ProductCode: {rawRequest.OrderRequestParameter.ProductCode ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.BaseOption: {rawRequest.OrderRequestParameter.BaseOption ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.OrderKind: {rawRequest.OrderRequestParameter.OrderKind ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Licenses: {rawRequest.OrderRequestParameter.Licenses ?? string.Empty}"); foreach (var opt in rawRequest.OrderRequestParameter.Options) { Logger.Trace($"PvOrderRequest.OrderRequestParameter.Option[{opt.OptionName}]: {opt.OptionValue}"); } - Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.Months: {rawRequest.OrderRequestParameter.ValidityPeriod.Months}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.NotBefore: {rawRequest.OrderRequestParameter.ValidityPeriod.NotBefore}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.NotAfter: {rawRequest.OrderRequestParameter.ValidityPeriod.NotAfter}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.CSR: {rawRequest.OrderRequestParameter.CSR}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.RenewalTargetOrderID: {rawRequest.OrderRequestParameter.RenewalTargetOrderID}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.TargetCert: {rawRequest.OrderRequestParameter.TargetCERT}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.SpecialInstructions: {rawRequest.OrderRequestParameter.SpecialInstructions}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.Coupon: {rawRequest.OrderRequestParameter.Coupon}"); - Logger.Trace($"PvOrderRequest.OrderRequestParameter.Campaign: {rawRequest.OrderRequestParameter.Campaign}"); - Logger.Trace($"PvOrderRequest.MsslProfileId: {rawRequest.MSSLProfileID}"); - Logger.Trace($"PvOrderRequest.MsslDomainId: {rawRequest.MSSLDomainID}"); - Logger.Trace($"PvOrderRequest.SubId: {rawRequest.SubID}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine1: {rawRequest.PVSealInfo.AddressLine1}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine2: {rawRequest.PVSealInfo.AddressLine2}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine3: {rawRequest.PVSealInfo.AddressLine3}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.PostalCode: {rawRequest.PVSealInfo.PostalCode}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.Phone: {rawRequest.PVSealInfo.Phone}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.Fax: {rawRequest.PVSealInfo.Fax}"); - Logger.Trace($"PvOrderRequest.ContactInfo.FirstName: {rawRequest.ContactInfo.FirstName}"); - Logger.Trace($"PvOrderRequest.ContactInfo.LastName: {rawRequest.ContactInfo.LastName}"); - Logger.Trace($"PvOrderRequest.ContactInfo.Phone: {rawRequest.ContactInfo.Phone}"); - Logger.Trace($"PvOrderRequest.ContactInfo.Email: {rawRequest.ContactInfo.Email}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.Months: {rawRequest.OrderRequestParameter.ValidityPeriod.Months ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.NotBefore: {rawRequest.OrderRequestParameter.ValidityPeriod.NotBefore ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.ValidityPeriod.NotAfter: {rawRequest.OrderRequestParameter.ValidityPeriod.NotAfter ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.CSR: {rawRequest.OrderRequestParameter.CSR ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.RenewalTargetOrderID: {rawRequest.OrderRequestParameter.RenewalTargetOrderID ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.TargetCert: {rawRequest.OrderRequestParameter.TargetCERT ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.SpecialInstructions: {rawRequest.OrderRequestParameter.SpecialInstructions ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Coupon: {rawRequest.OrderRequestParameter.Coupon ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.OrderRequestParameter.Campaign: {rawRequest.OrderRequestParameter.Campaign ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.MsslProfileId: {rawRequest.MSSLProfileID ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.MsslDomainId: {rawRequest.MSSLDomainID ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.SubId: {rawRequest.SubID ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine1: {rawRequest.PVSealInfo.AddressLine1 ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine2: {rawRequest.PVSealInfo.AddressLine2 ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine3: {rawRequest.PVSealInfo.AddressLine3 ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.PostalCode: {rawRequest.PVSealInfo.PostalCode ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.Phone: {rawRequest.PVSealInfo.Phone ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.Fax: {rawRequest.PVSealInfo.Fax ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.FirstName: {rawRequest.ContactInfo.FirstName ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.LastName: {rawRequest.ContactInfo.LastName ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.Phone: {rawRequest.ContactInfo.Phone ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.Email: {rawRequest.ContactInfo.Email ?? string.Empty}"); foreach (var san in rawRequest.SANEntries) { Logger.Trace($"PvOrderRequest.SAN: {san.SubjectAltName}, {san.SANOptionType}"); From 9e4438e479564abdce4186863e47b09d046ce15b Mon Sep 17 00:00:00 2001 From: David Galey Date: Wed, 17 Jul 2024 13:22:08 -0400 Subject: [PATCH 3/3] more loggings fixes --- .../Client/GlobalSignApiClient.cs | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs b/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs index 8309066..1cce0e9 100644 --- a/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs +++ b/src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs @@ -294,16 +294,22 @@ public EnrollmentResult Enroll(GlobalSignEnrollRequest enrollRequest) Logger.Trace($"PvOrderRequest.MsslProfileId: {rawRequest.MSSLProfileID ?? string.Empty}"); Logger.Trace($"PvOrderRequest.MsslDomainId: {rawRequest.MSSLDomainID ?? string.Empty}"); Logger.Trace($"PvOrderRequest.SubId: {rawRequest.SubID ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine1: {rawRequest.PVSealInfo.AddressLine1 ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine2: {rawRequest.PVSealInfo.AddressLine2 ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine3: {rawRequest.PVSealInfo.AddressLine3 ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.PostalCode: {rawRequest.PVSealInfo.PostalCode ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.Phone: {rawRequest.PVSealInfo.Phone ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.PvSealInfo.Fax: {rawRequest.PVSealInfo.Fax ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.ContactInfo.FirstName: {rawRequest.ContactInfo.FirstName ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.ContactInfo.LastName: {rawRequest.ContactInfo.LastName ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.ContactInfo.Phone: {rawRequest.ContactInfo.Phone ?? string.Empty}"); - Logger.Trace($"PvOrderRequest.ContactInfo.Email: {rawRequest.ContactInfo.Email ?? string.Empty}"); + if (rawRequest.PVSealInfo != null) + { + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine1: {rawRequest.PVSealInfo.AddressLine1 ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine2: {rawRequest.PVSealInfo.AddressLine2 ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.AddressLine3: {rawRequest.PVSealInfo.AddressLine3 ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.PostalCode: {rawRequest.PVSealInfo.PostalCode ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.Phone: {rawRequest.PVSealInfo.Phone ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.PvSealInfo.Fax: {rawRequest.PVSealInfo.Fax ?? string.Empty}"); + } + if (rawRequest.ContactInfo != null) + { + Logger.Trace($"PvOrderRequest.ContactInfo.FirstName: {rawRequest.ContactInfo.FirstName ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.LastName: {rawRequest.ContactInfo.LastName ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.Phone: {rawRequest.ContactInfo.Phone ?? string.Empty}"); + Logger.Trace($"PvOrderRequest.ContactInfo.Email: {rawRequest.ContactInfo.Email ?? string.Empty}"); + } foreach (var san in rawRequest.SANEntries) { Logger.Trace($"PvOrderRequest.SAN: {san.SubjectAltName}, {san.SANOptionType}");