WFE2: Implement badOrderState err type
This commit is contained in:
parent
c85d4b097b
commit
6008202357
|
@ -21,6 +21,7 @@ const (
|
||||||
CAAProblem = ProblemType("caa")
|
CAAProblem = ProblemType("caa")
|
||||||
DNSProblem = ProblemType("dns")
|
DNSProblem = ProblemType("dns")
|
||||||
AlreadyRevokedProblem = ProblemType("alreadyRevoked")
|
AlreadyRevokedProblem = ProblemType("alreadyRevoked")
|
||||||
|
OrderNotReadyProblem = ProblemType("orderNotReady")
|
||||||
|
|
||||||
V1ErrorNS = "urn:acme:error:"
|
V1ErrorNS = "urn:acme:error:"
|
||||||
V2ErrorNS = "urn:ietf:params:acme:error:"
|
V2ErrorNS = "urn:ietf:params:acme:error:"
|
||||||
|
@ -262,3 +263,12 @@ func DNS(detail string, a ...interface{}) *ProblemDetails {
|
||||||
HTTPStatus: http.StatusBadRequest,
|
HTTPStatus: http.StatusBadRequest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderNotReady returns a ProblemDetails representing a OrderNotReadyProblem
|
||||||
|
func OrderNotReady(detail string, a ...interface{}) *ProblemDetails {
|
||||||
|
return &ProblemDetails{
|
||||||
|
Type: OrderNotReadyProblem,
|
||||||
|
Detail: fmt.Sprintf(detail, a...),
|
||||||
|
HTTPStatus: http.StatusForbidden,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1808,7 +1808,7 @@ func (wfe *WebFrontEndImpl) FinalizeOrder(ctx context.Context, logEvent *web.Req
|
||||||
// Only ready orders can be finalized.
|
// Only ready orders can be finalized.
|
||||||
if *order.Status != string(core.StatusReady) {
|
if *order.Status != string(core.StatusReady) {
|
||||||
wfe.sendError(response, logEvent,
|
wfe.sendError(response, logEvent,
|
||||||
probs.Malformed(
|
probs.OrderNotReady(
|
||||||
"Order's status (%q) is not acceptable for finalization",
|
"Order's status (%q) is not acceptable for finalization",
|
||||||
*order.Status),
|
*order.Status),
|
||||||
nil)
|
nil)
|
||||||
|
|
|
@ -2165,7 +2165,7 @@ func TestFinalizeOrder(t *testing.T) {
|
||||||
Name: "Order is already finalized",
|
Name: "Order is already finalized",
|
||||||
// mocks/mocks.go's StorageAuthority's GetOrder mock treats ID 1 as an Order with a Serial
|
// mocks/mocks.go's StorageAuthority's GetOrder mock treats ID 1 as an Order with a Serial
|
||||||
Request: signAndPost(t, "1/1", "http://localhost/1/1", goodCertCSRPayload, 1, wfe.nonceService),
|
Request: signAndPost(t, "1/1", "http://localhost/1/1", goodCertCSRPayload, 1, wfe.nonceService),
|
||||||
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `malformed","detail":"Order's status (\"valid\") is not acceptable for finalization","status":400}`,
|
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `orderNotReady","detail":"Order's status (\"valid\") is not acceptable for finalization","status":403}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Order is expired",
|
Name: "Order is expired",
|
||||||
|
@ -2176,7 +2176,7 @@ func TestFinalizeOrder(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: "Good CSR, Pending Order",
|
Name: "Good CSR, Pending Order",
|
||||||
Request: signAndPost(t, "1/4", "http://localhost/1/4", goodCertCSRPayload, 1, wfe.nonceService),
|
Request: signAndPost(t, "1/4", "http://localhost/1/4", goodCertCSRPayload, 1, wfe.nonceService),
|
||||||
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `malformed","detail":"Order's status (\"pending\") is not acceptable for finalization","status":400}`,
|
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `orderNotReady","detail":"Order's status (\"pending\") is not acceptable for finalization","status":403}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Good CSR, Ready Order",
|
Name: "Good CSR, Ready Order",
|
||||||
|
|
Loading…
Reference in New Issue