Explorar o código

fix: same issue as with oidc challenge

beltram %!s(int64=3) %!d(string=hai) anos
pai
achega
2be77385f6
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      acme/challenge.go

+ 5 - 3
acme/challenge.go

@@ -605,11 +605,13 @@ func wireDPOP01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSO
 		return WrapErrorISE(err, "Could not find current order by account id")
 	}
 
-	if len(orders) != 1 {
-		return WrapErrorISE(err, "There are too many orders for this account for this custom DPoP challenge")
+	if len(orders) == 0 {
+		return WrapErrorISE(err, "There are not enough orders for this account for this custom OIDC challenge")
 	}
 
-	if err := db.CreateDpopToken(ctx, orders[0], dpop); err != nil {
+	order := orders[len(orders)-1]
+
+	if err := db.CreateDpopToken(ctx, order, dpop); err != nil {
 		return WrapErrorISE(err, "Failed storing DPoP token")
 	}