Skip to content

Commit

Permalink
Add logging of enroll request
Browse files Browse the repository at this point in the history
  • Loading branch information
dgaley committed Feb 27, 2024
1 parent ebd4840 commit e814199
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/GlobalSignCAProxy/Api/GlobalSignEnrollRequest.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Copyright 2021 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
// and limitations under the License.

using Keyfactor.Extensions.AnyGateway.GlobalSign.Services.Order;
// Copyright 2021 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
// and limitations under the License.

using Keyfactor.Extensions.AnyGateway.GlobalSign.Services.Order;

using System.Collections.Generic;

namespace Keyfactor.Extensions.AnyGateway.GlobalSign.Api
{
{
public class GlobalSignEnrollRequest
{
internal GlobalSignCAConfig Config;


public GlobalSignEnrollRequest(GlobalSignCAConfig config)
{
Config = config;
Expand Down Expand Up @@ -85,13 +85,12 @@ public BmV2PvOrderRequest Request
entry.SubjectAltName = item;
if (item.StartsWith("*"))
{
entry.SubjectAltName = "13";
entry.SANOptionType = "13";
}
else
{
entry.SubjectAltName = "7";
}
sans.Add(entry);
entry.SANOptionType = "7";
}
}
request.SANEntries = sans.ToArray();
}
Expand All @@ -110,7 +109,7 @@ public BmV2PvOrderRequest Request
{
request.OrderRequestParameter.BaseOption = BaseOption;
}


return request;
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/GlobalSignCAProxy/Client/GlobalSignApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ public EnrollmentResult Enroll(GlobalSignEnrollRequest enrollRequest)
Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug);
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($"SANs: {string.Join(",", rawRequest.SANEntries.Select(s => s.SubjectAltName))}");
}
Logger.Trace($"Product Code: {rawRequest.OrderRequestParameter.ProductCode}");
Logger.Trace($"Order Kind: {rawRequest.OrderRequestParameter.OrderKind}");
var response = OrderService.PVOrder(enrollRequest.Request);
if (response.OrderResponseHeader.SuccessCode == 0)
{
Expand Down

0 comments on commit e814199

Please sign in to comment.