Skip to content

Commit

Permalink
Bugfix: URLs should be case-insensitive (#1159)
Browse files Browse the repository at this point in the history
- Adds additional mappings to controller endpoints with two word path segments to mitigate inaccuracies in the clients which might expect camelCase paths in these cases

Updates #1158
{patch}

Signed-off-by: Esta Nagy <[email protected]>
  • Loading branch information
nagyesta authored Sep 26, 2024
1 parent f823df3 commit 1e75ee2
Show file tree
Hide file tree
Showing 18 changed files with 116 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultKeyItemModel>> listKeys(
}

@Override
@GetMapping(value = {"/deletedkeys", "/deletedkeys/"},
@GetMapping(value = {"/deletedkeys", "/deletedkeys/",
"/deletedKeys", "/deletedKeys/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultKeyItemModel>> listDeletedKeys(
Expand Down Expand Up @@ -142,7 +143,8 @@ public ResponseEntity<KeyVaultKeyModel> updateVersion(
}

@Override
@GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
@GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/",
"/deletedKeys/{keyName}", "/deletedKeys/{keyName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<DeletedKeyVaultKeyModel> getDeletedKey(
Expand All @@ -152,7 +154,8 @@ public ResponseEntity<DeletedKeyVaultKeyModel> getDeletedKey(
}

@Override
@PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/"},
@PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/",
"/deletedKeys/{keyName}/recover", "/deletedKeys/{keyName}/recover/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultKeyModel> recoverDeletedKey(
Expand All @@ -162,7 +165,8 @@ public ResponseEntity<KeyVaultKeyModel> recoverDeletedKey(
}

@Override
@DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
@DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/",
"/deletedKeys/{keyName}", "/deletedKeys/{keyName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public KeyCryptoController(@NonNull final KeyConverterRegistry registry, @NonNul

@Override
@PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/encrypt/",
"/keys/{keyName}/{keyVersion}/wrapkey", "/keys/{keyName}/{keyVersion}/wrapkey/"},
"/keys/{keyName}/{keyVersion}/wrapkey", "/keys/{keyName}/{keyVersion}/wrapkey/",
"/keys/{keyName}/{keyVersion}/wrapKey", "/keys/{keyName}/{keyVersion}/wrapKey/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand All @@ -53,7 +54,8 @@ public ResponseEntity<KeyOperationsResult> encrypt(

@Override
@PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/decrypt/",
"/keys/{keyName}/{keyVersion}/unwrapkey", "/keys/{keyName}/{keyVersion}/unwrapkey/"},
"/keys/{keyName}/{keyVersion}/unwrapkey", "/keys/{keyName}/{keyVersion}/unwrapkey/",
"/keys/{keyName}/{keyVersion}/unwrapKey", "/keys/{keyName}/{keyVersion}/unwrapKey/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultSecretItemModel>> listSecret
}

@Override
@GetMapping(value = {"/deletedsecrets", "/deletedsecrets/"},
@GetMapping(value = {"/deletedsecrets", "/deletedsecrets/",
"/deletedSecrets", "/deletedSecrets/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultSecretItemModel>> listDeletedSecrets(
Expand Down Expand Up @@ -129,7 +130,8 @@ public ResponseEntity<KeyVaultSecretModel> updateVersion(
}

@Override
@GetMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
@GetMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/",
"/deletedSecrets/{secretName}", "/deletedSecrets/{secretName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultSecretModel> getDeletedSecret(
Expand All @@ -139,7 +141,8 @@ public ResponseEntity<KeyVaultSecretModel> getDeletedSecret(
}

@Override
@DeleteMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
@DeleteMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/",
"/deletedSecrets/{secretName}", "/deletedSecrets/{secretName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand All @@ -149,7 +152,8 @@ public ResponseEntity<Void> purgeDeleted(
}

@Override
@PostMapping(value = {"/deletedsecrets/{secretName}/recover", "/deletedsecrets/{secretName}/recover/"},
@PostMapping(value = {"/deletedsecrets/{secretName}/recover", "/deletedsecrets/{secretName}/recover/",
"/deletedSecrets/{secretName}/recover", "/deletedSecrets/{secretName}/recover/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultSecretModel> recoverDeletedSecret(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public ResponseEntity<DeletedKeyVaultCertificateModel> delete(

@Override
@GetMapping(
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/"},
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/",
"/deletedCertificates/{certificateName}", "/deletedCertificates/{certificateName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<DeletedKeyVaultCertificateModel> getDeletedCertificate(
Expand All @@ -105,7 +106,8 @@ public ResponseEntity<DeletedKeyVaultCertificateModel> getDeletedCertificate(

@Override
@PostMapping(
value = {"/deletedcertificates/{certificateName}/recover", "/deletedcertificates/{certificateName}/recover/"},
value = {"/deletedcertificates/{certificateName}/recover", "/deletedcertificates/{certificateName}/recover/",
"/deletedCertificates/{certificateName}/recover", "/deletedCertificates/{certificateName}/recover/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultCertificateModel> recoverDeletedCertificate(
Expand All @@ -116,7 +118,8 @@ public ResponseEntity<KeyVaultCertificateModel> recoverDeletedCertificate(

@Override
@DeleteMapping(
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/"},
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/",
"/deletedCertificates/{certificateName}", "/deletedCertificates/{certificateName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand Down Expand Up @@ -153,7 +156,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultCertificateItemModel>> listC

@Override
@GetMapping(
value = {"/deletedcertificates", "/deletedcertificates/"},
value = {"/deletedcertificates", "/deletedcertificates/",
"/deletedCertificates", "/deletedCertificates/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultCertificateItemModel>> listDeletedCertificates(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultKeyItemModel>> listKeys(
}

@Override
@GetMapping(value = {"/deletedkeys", "/deletedkeys/"},
@GetMapping(value = {"/deletedkeys", "/deletedkeys/",
"/deletedKeys", "/deletedKeys/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultKeyItemModel>> listDeletedKeys(
Expand Down Expand Up @@ -158,7 +159,8 @@ public ResponseEntity<KeyVaultKeyModel> rotateKey(
}

@Override
@GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
@GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/",
"/deletedKeys/{keyName}", "/deletedKeys/{keyName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<DeletedKeyVaultKeyModel> getDeletedKey(
Expand All @@ -168,7 +170,8 @@ public ResponseEntity<DeletedKeyVaultKeyModel> getDeletedKey(
}

@Override
@PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/"},
@PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/",
"/deletedKeys/{keyName}/recover", "/deletedKeys/{keyName}/recover/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultKeyModel> recoverDeletedKey(
Expand All @@ -178,7 +181,8 @@ public ResponseEntity<KeyVaultKeyModel> recoverDeletedKey(
}

@Override
@DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
@DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/",
"/deletedKeys/{keyName}", "/deletedKeys/{keyName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public KeyCryptoController(@NonNull final KeyConverterRegistry registry, @NonNul

@Override
@PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/encrypt/",
"/keys/{keyName}/{keyVersion}/wrapkey", "/keys/{keyName}/{keyVersion}/wrapkey/"},
"/keys/{keyName}/{keyVersion}/wrapkey", "/keys/{keyName}/{keyVersion}/wrapkey/",
"/keys/{keyName}/{keyVersion}/wrapKey", "/keys/{keyName}/{keyVersion}/wrapKey/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand All @@ -56,7 +57,8 @@ public ResponseEntity<KeyOperationsResult> encrypt(

@Override
@PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/decrypt/",
"/keys/{keyName}/{keyVersion}/unwrapkey", "/keys/{keyName}/{keyVersion}/unwrapkey/"},
"/keys/{keyName}/{keyVersion}/unwrapkey", "/keys/{keyName}/{keyVersion}/unwrapkey/",
"/keys/{keyName}/{keyVersion}/unwrapKey", "/keys/{keyName}/{keyVersion}/unwrapKey/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public KeyPolicyController(@NonNull final KeyConverterRegistry registry, @NonNul
super(registry, vaultService);
}

@GetMapping(value = {"/keys/{keyName}/rotationpolicy", "/keys/{keyName}/rotationpolicy/"},
@GetMapping(value = {"/keys/{keyName}/rotationpolicy", "/keys/{keyName}/rotationpolicy/",
"/keys/{keyName}/rotationPolicy", "/keys/{keyName}/rotationPolicy/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyRotationPolicyModel> getRotationPolicy(
Expand All @@ -40,7 +41,8 @@ public ResponseEntity<KeyRotationPolicyModel> getRotationPolicy(
return super.getRotationPolicy(keyName, baseUri);
}

@PutMapping(value = {"/keys/{keyName}/rotationpolicy", "/keys/{keyName}/rotationpolicy/"},
@PutMapping(value = {"/keys/{keyName}/rotationpolicy", "/keys/{keyName}/rotationpolicy/",
"/keys/{keyName}/rotationPolicy", "/keys/{keyName}/rotationPolicy/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultSecretItemModel>> listSecret
}

@Override
@GetMapping(value = {"/deletedsecrets", "/deletedsecrets/"},
@GetMapping(value = {"/deletedsecrets", "/deletedsecrets/",
"/deletedSecrets", "/deletedSecrets/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultSecretItemModel>> listDeletedSecrets(
Expand Down Expand Up @@ -129,7 +130,8 @@ public ResponseEntity<KeyVaultSecretModel> updateVersion(
}

@Override
@GetMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
@GetMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/",
"/deletedSecrets/{secretName}", "/deletedSecrets/{secretName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultSecretModel> getDeletedSecret(
Expand All @@ -139,7 +141,8 @@ public ResponseEntity<KeyVaultSecretModel> getDeletedSecret(
}

@Override
@DeleteMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
@DeleteMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/",
"/deletedSecrets/{secretName}", "/deletedSecrets/{secretName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand All @@ -149,7 +152,8 @@ public ResponseEntity<Void> purgeDeleted(
}

@Override
@PostMapping(value = {"/deletedsecrets/{secretName}/recover", "/deletedsecrets/{secretName}/recover/"},
@PostMapping(value = {"/deletedsecrets/{secretName}/recover", "/deletedsecrets/{secretName}/recover/",
"/deletedSecrets/{secretName}/recover", "/deletedSecrets/{secretName}/recover/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultSecretModel> recoverDeletedSecret(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public ResponseEntity<DeletedKeyVaultCertificateModel> delete(

@Override
@GetMapping(
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/"},
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/",
"/deletedCertificates/{certificateName}", "/deletedCertificates/{certificateName}/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<DeletedKeyVaultCertificateModel> getDeletedCertificate(
Expand All @@ -105,7 +106,8 @@ public ResponseEntity<DeletedKeyVaultCertificateModel> getDeletedCertificate(

@Override
@PostMapping(
value = {"/deletedcertificates/{certificateName}/recover", "/deletedcertificates/{certificateName}/recover/"},
value = {"/deletedcertificates/{certificateName}/recover", "/deletedcertificates/{certificateName}/recover/",
"/deletedCertificates/{certificateName}/recover", "/deletedCertificates/{certificateName}/recover/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultCertificateModel> recoverDeletedCertificate(
Expand All @@ -116,7 +118,8 @@ public ResponseEntity<KeyVaultCertificateModel> recoverDeletedCertificate(

@Override
@DeleteMapping(
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/"},
value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/",
"/deletedCertificates/{certificateName}", "/deletedCertificates/{certificateName}/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand Down Expand Up @@ -153,7 +156,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultCertificateItemModel>> listC

@Override
@GetMapping(
value = {"/deletedcertificates", "/deletedcertificates/"},
value = {"/deletedcertificates", "/deletedcertificates/",
"/deletedCertificates", "/deletedCertificates/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultCertificateItemModel>> listDeletedCertificates(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public ResponseEntity<KeyVaultItemListModel<KeyVaultKeyItemModel>> listKeys(
}

@Override
@GetMapping(value = {"/deletedkeys", "/deletedkeys/"},
@GetMapping(value = {"/deletedkeys", "/deletedkeys/",
"/deletedKeys", "/deletedKeys/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultItemListModel<DeletedKeyVaultKeyItemModel>> listDeletedKeys(
Expand Down Expand Up @@ -158,7 +159,8 @@ public ResponseEntity<KeyVaultKeyModel> rotateKey(
}

@Override
@GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
@GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/",
"/deletedKeys/{keyName}", "/deletedKeys/{keyName}/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<DeletedKeyVaultKeyModel> getDeletedKey(
Expand All @@ -168,7 +170,8 @@ public ResponseEntity<DeletedKeyVaultKeyModel> getDeletedKey(
}

@Override
@PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/"},
@PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/",
"/deletedKeys/{keyName}/recover", "/deletedKeys/{keyName}/recover/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<KeyVaultKeyModel> recoverDeletedKey(
Expand All @@ -178,7 +181,8 @@ public ResponseEntity<KeyVaultKeyModel> recoverDeletedKey(
}

@Override
@DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
@DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/",
"/deletedKeys/{keyName}", "/deletedKeys/{keyName}/"},
params = API_VERSION_7_4,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> purgeDeleted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public KeyCryptoController(@NonNull final KeyConverterRegistry registry, @NonNul

@Override
@PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/encrypt/",
"/keys/{keyName}/{keyVersion}/wrapkey", "/keys/{keyName}/{keyVersion}/wrapkey/"},
"/keys/{keyName}/{keyVersion}/wrapkey", "/keys/{keyName}/{keyVersion}/wrapkey/",
"/keys/{keyName}/{keyVersion}/wrapKey", "/keys/{keyName}/{keyVersion}/wrapKey/"},
params = API_VERSION_7_4,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand All @@ -56,7 +57,8 @@ public ResponseEntity<KeyOperationsResult> encrypt(

@Override
@PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/decrypt/",
"/keys/{keyName}/{keyVersion}/unwrapkey", "/keys/{keyName}/{keyVersion}/unwrapkey/"},
"/keys/{keyName}/{keyVersion}/unwrapkey", "/keys/{keyName}/{keyVersion}/unwrapkey/",
"/keys/{keyName}/{keyVersion}/unwrapKey", "/keys/{keyName}/{keyVersion}/unwrapKey/"},
params = API_VERSION_7_4,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
Expand Down
Loading

0 comments on commit 1e75ee2

Please sign in to comment.