Skip to content

Commit b987fc6

Browse files
dgaleymkachkKeyfactor
authored
Dev 1.1 (#6)
* Update to provide "Enabled" flag support for SAAS deployment. * Update generated docs * Fixing build. * Fixes for enabled. * Update generated docs * More fixes. * remove retry logic for reissue pickup * changelog * Update keyfactor-bootstrap-workflow.yml * Update keyfactor-bootstrap-workflow.yml --------- Co-authored-by: Mark Kachkaev <mark.kachkaev@keyfactor.com> Co-authored-by: Keyfactor <keyfactor@keyfactor.github.io>
1 parent 65b0b9f commit b987fc6

3 files changed

Lines changed: 60 additions & 58 deletions

File tree

.github/workflows/keyfactor-bootstrap-workflow.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,10 @@ on:
1111

1212
jobs:
1313
call-starter-workflow:
14-
uses: keyfactor/actions/.github/workflows/starter.yml@v4
15-
permissions:
16-
contents: write # Explicitly grant write permission
17-
with:
18-
command_token_url: ${{ vars.COMMAND_TOKEN_URL }}
19-
command_hostname: ${{ vars.COMMAND_HOSTNAME }}
20-
command_base_api_path: ${{ vars.COMMAND_API_PATH }}
14+
uses: keyfactor/actions/.github/workflows/starter.yml@v3
2115
secrets:
2216
token: ${{ secrets.V2BUILDTOKEN}}
17+
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
2318
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
2419
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}
2520
scan_token: ${{ secrets.SAST_TOKEN }}
26-
entra_username: ${{ secrets.DOCTOOL_ENTRA_USERNAME }}
27-
entra_password: ${{ secrets.DOCTOOL_ENTRA_PASSWD }}
28-
command_client_id: ${{ secrets.COMMAND_CLIENT_ID }}
29-
command_client_secret: ${{ secrets.COMMAND_CLIENT_SECRET }}

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
v1.0
2-
-Initial Release.
2+
-Initial Release.
3+
4+
1.1
5+
Remove retry logic around reissue pickups

globalsign-mssl-caplugin/Client/GlobalSignApiClient.cs

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -157,64 +157,63 @@ public async Task<AnyCAPluginCertificate> PickupCertificateById(string caRequest
157157
}
158158
};
159159

160-
var retryCounter = 0;
161-
while (retryCounter <= Config.PickupRetries)
160+
var wrapper = new GetOrderByOrderID(request);
161+
var responseWrapper = await QueryService.GetOrderByOrderIDAsync(wrapper);
162+
var response = responseWrapper.Response;
163+
164+
if (response.OrderResponseHeader.SuccessCode == 0)
162165
{
163-
var wrapper = new GetOrderByOrderID(request);
164-
var responseWrapper = await QueryService.GetOrderByOrderIDAsync(wrapper);
165-
var response = responseWrapper.Response;
166+
Logger.LogDebug($"Order with order ID {caRequestId} successfully picked up");
167+
var orderStatus = (GlobalSignOrderStatus)Enum.Parse(
168+
typeof(GlobalSignOrderStatus),
169+
response.OrderDetail.CertificateInfo.CertificateStatus);
166170

167-
if (response.OrderResponseHeader.SuccessCode == 0)
171+
if (orderStatus == GlobalSignOrderStatus.Issued)
168172
{
169-
Logger.LogDebug($"Order with order ID {caRequestId} successfully picked up");
170-
var orderStatus = (GlobalSignOrderStatus)Enum.Parse(
171-
typeof(GlobalSignOrderStatus),
172-
response.OrderDetail.CertificateInfo.CertificateStatus);
173-
174-
if (orderStatus == GlobalSignOrderStatus.Issued)
173+
var orderDate = DateTime.TryParse(
174+
response.OrderDetail.OrderInfo.OrderDate,
175+
out var od)
176+
? od
177+
: (DateTime?)null;
178+
var completeDate = DateTime.TryParse(
179+
response.OrderDetail.OrderInfo.OrderCompleteDate,
180+
out var cd)
181+
? cd
182+
: (DateTime?)null;
183+
var deactivateDate = DateTime.TryParse(
184+
response.OrderDetail.OrderInfo.OrderDeactivatedDate,
185+
out var de)
186+
? de
187+
: (DateTime?)null;
188+
189+
Logger.MethodExit();
190+
return new AnyCAPluginCertificate
175191
{
176-
var orderDate = DateTime.TryParse(
177-
response.OrderDetail.OrderInfo.OrderDate,
178-
out var od)
179-
? od
180-
: (DateTime?)null;
181-
var completeDate = DateTime.TryParse(
182-
response.OrderDetail.OrderInfo.OrderCompleteDate,
183-
out var cd)
184-
? cd
185-
: (DateTime?)null;
186-
var deactivateDate = DateTime.TryParse(
187-
response.OrderDetail.OrderInfo.OrderDeactivatedDate,
188-
out var de)
189-
? de
190-
: (DateTime?)null;
191-
192-
Logger.MethodExit();
193-
return new AnyCAPluginCertificate
194-
{
195-
CARequestID = caRequestId,
196-
ProductID = response.OrderDetail.OrderInfo.ProductCode,
197-
Status = OrderStatus.ConvertToKeyfactorStatus(orderStatus),
198-
CSR = response.OrderDetail.Fulfillment.OriginalCSR,
199-
Certificate = response.OrderDetail.Fulfillment.ServerCertificate.X509Cert,
200-
RevocationReason = 0,
201-
RevocationDate = orderStatus == GlobalSignOrderStatus.Revoked ? deactivateDate : null
202-
};
203-
}
192+
CARequestID = caRequestId,
193+
ProductID = response.OrderDetail.OrderInfo.ProductCode,
194+
Status = OrderStatus.ConvertToKeyfactorStatus(orderStatus),
195+
CSR = response.OrderDetail.Fulfillment.OriginalCSR,
196+
Certificate = response.OrderDetail.Fulfillment.ServerCertificate.X509Cert,
197+
RevocationReason = 0,
198+
RevocationDate = orderStatus == GlobalSignOrderStatus.Revoked ? deactivateDate : null
199+
};
204200
}
205-
206-
retryCounter++;
207-
Logger.LogDebug(
208-
$"Pickup certificate failed for order ID {caRequestId}. Attempt {retryCounter} of {Config.PickupRetries}.{(retryCounter < Config.PickupRetries ? " Retrying..." : string.Empty)}");
209-
await Task.Delay(TimeSpan.FromSeconds(Config.PickupDelay));
210201
}
211202

203+
Logger.LogInformation(
204+
$"Certificate for order ID {caRequestId} was not immediately available. Once issued, it should be picked up by the next gateway sync.");
205+
206+
212207
var gsError = GlobalSignErrorIndex.GetGlobalSignError(-9916);
213208
var errorMsg =
214209
"Unable to pickup certificate during configured pickup window. Check for required approvals in GlobalSign portal. This can also be caused by a delay with GlobalSign, in which case the certificate will get picked up by a future sync";
215210
Logger.LogError(errorMsg);
216211
Logger.LogError(gsError.DetailedMessage);
217-
throw new Exception(errorMsg);
212+
return new AnyCAPluginCertificate()
213+
{
214+
CARequestID = caRequestId,
215+
Status = (int)EndEntityStatus.INPROCESS
216+
};
218217
}
219218

220219
public async Task<List<GetDomainsDomainDetail>> GetDomains()
@@ -418,6 +417,15 @@ public async Task<EnrollmentResult> Reissue(GlobalSignReissueRequest reissueRequ
418417

419418
// Pick up the certificate after reissue
420419
var pickupResponse = await PickupCertificateById(response.OrderID);
420+
421+
if (pickupResponse.Status == (int)EndEntityStatus.INPROCESS)
422+
{
423+
return new EnrollmentResult
424+
{
425+
CARequestID = response.OrderID,
426+
Status = (int)EndEntityStatus.INPROCESS
427+
};
428+
}
421429
var cert = CertificateConverterFactory.FromPEM(pickupResponse.Certificate).ToX509Certificate2();
422430

423431
// If newly generated or serial differs, return success

0 commit comments

Comments
 (0)