diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/java/org/wso2/carbon/apimgt/rest/api/common/RestApiConstants.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/java/org/wso2/carbon/apimgt/rest/api/common/RestApiConstants.java index b9ee6a70056d..f36b87e33521 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/java/org/wso2/carbon/apimgt/rest/api/common/RestApiConstants.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/java/org/wso2/carbon/apimgt/rest/api/common/RestApiConstants.java @@ -303,7 +303,7 @@ public final class RestApiConstants { public static final String MIGRATION_MODE = "migrationMode"; public static final String CERTS_BASE_PATH = "/certificates"; - public static final String CLIENT_CERTS_BASE_PATH = "/clientCertificates/v2/"; + public static final String CLIENT_CERTS_BASE_PATH = "/client-certs/"; public static final String CERTS_GET_PAGINATED_URL = CERTS_BASE_PATH + "?limit=" + LIMIT_PARAM + "&offset=" + OFFSET_PARAM + QUERY_PARAM; public static final String CLIENT_CERTS_GET_PAGINATED_URL = diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml index 1f4536a16f6a..a1370de98dc1 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml @@ -4554,6 +4554,9 @@ paths: source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://127.0.0.1:9443/api/am/publisher/v4/throttling-policies/api/Platinum"' + ###################################################### + # The "Client Certificates" resource APIs (Deprecated) + ###################################################### /apis/{apiId}/client-certificates: get: tags: @@ -4669,33 +4672,25 @@ paths: "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates"' operationId: addAPIClientCertificate - /apis/{apiId}/client-certificates/v2/{keyType}: - parameters: - - in: path - name: keyType - schema: - type: string - required: true - description: Key type for the certificate + /apis/{apiId}/client-certificates/{alias}: get: + deprecated: true tags: - Client Certificates - summary: Retrieve/ Search Uploaded Client Certificates of a given key type + summary: Get the Certificate Information description: | - This operation can be used to retrieve and search the uploaded client certificates of a given key type. + This operation can be used to get the information about a certificate. parameters: - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - name: alias - in: query - description: Alias for the client certificate + in: path + required: true schema: type: string - $ref: '#/components/parameters/apiId' responses: 200: description: | - OK. Successful response with the list of matching certificate information in the body. + OK. headers: Content-Type: description: | @@ -4705,9 +4700,11 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ClientCertificates' + $ref: '#/components/schemas/CertificateInfo' 400: $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' 500: $ref: '#/components/responses/InternalServerError' security: @@ -4719,43 +4716,47 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates?alias=wso2carbon"' - operationId: getAPIClientCertificatesByKeyType - post: + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: getAPIClientCertificateByAlias + + put: + deprecated: true tags: - Client Certificates - summary: Upload a New Certificate of the given key type + summary: Update a Certificate description: | - This operation can be used to upload a new certificate for an endpoint of the given type. + This operation can be used to update an uploaded certificate. parameters: + - name: alias + in: path + description: Alias for the certificate + required: true + schema: + maxLength: 30 + minLength: 1 + type: string - $ref: '#/components/parameters/apiId' requestBody: content: multipart/form-data: schema: - required: - - alias - - certificate - - tier properties: certificate: type: string description: The certificate that needs to be uploaded. format: binary - alias: - maxLength: 30 - minLength: 1 - type: string - description: Alias for the certificate tier: type: string - description: API tier to which the certificate should be applied. - required: true + description: The tier of the certificate + keyType: + type: string + description: Whether the key type is PRODUCTION or SANDBOX + default: PRODUCTION responses: 200: description: | OK. - The Certificate added successfully. + The Certificate updated successfully. headers: Location: description: | @@ -4773,32 +4774,35 @@ paths: $ref: '#/components/schemas/ClientCertMetadata' 400: $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' 500: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - apim:api_create - apim:api_manage - - apim:client_certificates_add + - apim:client_certificates_update - apim:client_certificates_manage x-code-samples: - lang: Curl - source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon -F tier=Gold - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates"' - operationId: addAPIClientCertificateOfGivenKeyType + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon + -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: updateAPIClientCertificateByAlias - /apis/{apiId}/client-certificates/{alias}: - get: + delete: deprecated: true tags: - Client Certificates - summary: Get the Certificate Information + summary: Delete a Certificate description: | - This operation can be used to get the information about a certificate. + This operation can be used to delete an uploaded certificate. parameters: - name: alias in: path + description: | + The alias of the certificate that should be deleted. required: true schema: type: string @@ -4807,16 +4811,14 @@ paths: 200: description: | OK. + The Certificate deleted successfully. headers: Content-Type: description: | The content type of the body. schema: type: string - content: - application/json: - schema: - $ref: '#/components/schemas/CertificateInfo' + content: {} 400: $ref: '#/components/responses/BadRequest' 404: @@ -4825,69 +4827,41 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apim:api_view + - apim:api_create - apim:api_manage - - apim:client_certificates_view - - apim:client_certificates_manage + - apim:client_certificates_update x-code-samples: - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' - operationId: getAPIClientCertificateByAlias + operationId: deleteAPIClientCertificateByAlias - put: + /apis/{apiId}/client-certificates/{alias}/content: + get: deprecated: true tags: - Client Certificates - summary: Update a Certificate + summary: Download a Certificate description: | - This operation can be used to update an uploaded certificate. + This operation can be used to download a certificate which matches the given alias. parameters: + - $ref: '#/components/parameters/apiId' - name: alias in: path - description: Alias for the certificate required: true schema: - maxLength: 30 - minLength: 1 type: string - - $ref: '#/components/parameters/apiId' - requestBody: - content: - multipart/form-data: - schema: - properties: - certificate: - type: string - description: The certificate that needs to be uploaded. - format: binary - tier: - type: string - description: The tier of the certificate - keyType: - type: string - description: Whether the key type is PRODUCTION or SANDBOX - default: PRODUCTION responses: 200: description: | OK. - The Certificate updated successfully. headers: - Location: - description: | - The URL of the newly created resource. - schema: - type: string Content-Type: description: | The content type of the body. schema: type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ClientCertMetadata' + content: {} 400: $ref: '#/components/responses/BadRequest' 404: @@ -4896,62 +4870,139 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apim:api_create + - apim:api_view - apim:api_manage - - apim:client_certificates_update + - apim:client_certificates_view - apim:client_certificates_manage x-code-samples: - lang: Curl - source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon - -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' - operationId: updateAPIClientCertificateByAlias + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content" > test.crt' + operationId: getAPIClientCertificateContentByAlias - delete: - deprecated: true + ###################################################### + # The "Client Certificates" resource APIs (New) + ###################################################### + /apis/{apiId}/client-certs/{keyType}: + parameters: + - in: path + name: keyType + schema: + type: string + required: true + description: Key type for the certificate + get: tags: - Client Certificates - summary: Delete a Certificate + summary: Retrieve/ Search Uploaded Client Certificates of a given key type description: | - This operation can be used to delete an uploaded certificate. + This operation can be used to retrieve and search the uploaded client certificates of a given key type. parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' - name: alias - in: path - description: | - The alias of the certificate that should be deleted. - required: true + in: query + description: Alias for the client certificate schema: type: string - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. Successful response with the list of matching certificate information in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertificates' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:api_manage + - apim:client_certificates_view + - apim:client_certificates_manage + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION?alias=wso2carbon"' + operationId: getAPIClientCertificatesByKeyType + post: + tags: + - Client Certificates + summary: Upload a New Certificate of the given key type + description: | + This operation can be used to upload a new certificate for an endpoint of the given type. + parameters: + - $ref: '#/components/parameters/apiId' + requestBody: + content: + multipart/form-data: + schema: + required: + - alias + - certificate + - tier + properties: + certificate: + type: string + description: The certificate that needs to be uploaded. + format: binary + alias: + maxLength: 30 + minLength: 1 + type: string + description: Alias for the certificate + tier: + type: string + description: API tier to which the certificate should be applied. + required: true responses: 200: description: | OK. - The Certificate deleted successfully. + The Certificate added successfully. headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string Content-Type: description: | The content type of the body. schema: type: string - content: {} + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertMetadata' 400: $ref: '#/components/responses/BadRequest' - 404: - $ref: '#/components/responses/NotFound' 500: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - apim:api_create - apim:api_manage - - apim:client_certificates_update + - apim:client_certificates_add + - apim:client_certificates_manage x-code-samples: - lang: Curl - source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' - operationId: deleteAPIClientCertificateByAlias - /apis/{apiId}/client-certificates/v2/{keyType}/{alias}: + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon -F tier=Gold + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION"' + operationId: addAPIClientCertificateOfGivenKeyType + + /apis/{apiId}/client-certs/{keyType}/{alias}: parameters: - in: path name: keyType @@ -5001,7 +5052,7 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION/wso2carbon"' operationId: getAPIClientCertificateByKeyTypeAndAlias put: @@ -5068,7 +5119,7 @@ paths: - lang: Curl source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon - -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION/wso2carbon"' operationId: updateAPIClientCertificateByKeyTypeAndAlias delete: @@ -5115,52 +5166,7 @@ paths: "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' operationId: deleteAPIClientCertificateByKeyTypeAndAlias - - /apis/{apiId}/client-certificates/{alias}/content: - get: - deprecated: true - tags: - - Client Certificates - summary: Download a Certificate - description: | - This operation can be used to download a certificate which matches the given alias. - parameters: - - $ref: '#/components/parameters/apiId' - - name: alias - in: path - required: true - schema: - type: string - responses: - 200: - description: | - OK. - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: {} - 400: - $ref: '#/components/responses/BadRequest' - 404: - $ref: '#/components/responses/NotFound' - 500: - $ref: '#/components/responses/InternalServerError' - security: - - OAuth2Security: - - apim:api_view - - apim:api_manage - - apim:client_certificates_view - - apim:client_certificates_manage - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content" > test.crt' - operationId: getAPIClientCertificateContentByAlias - - /apis/{apiId}/client-certificates/v2/{keyType}/{alias}/content: + /apis/{apiId}/client-certs/{keyType}/{alias}/content: get: tags: - Client Certificates @@ -5207,7 +5213,7 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content" > test.crt' + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION/wso2carbon/content" > test.crt' operationId: getAPIClientCertificateContentByKeyTypeAndAlias diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/CertificateRestApiUtils.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/CertificateRestApiUtils.java index a6f131d9a40a..b9633a0f6da7 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/CertificateRestApiUtils.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/CertificateRestApiUtils.java @@ -201,7 +201,7 @@ public static ClientCertificatesDTO getPaginatedClientCertificates( Map paginatedParams = RestApiCommonUtil.getPaginationParams(offset, limit, certCount); String paginatedPrevious = ""; String paginatedNext = ""; - //base path of pagination url -> deptecated api + if (paginatedParams.get(RestApiConstants.PAGINATION_PREVIOUS_OFFSET) != null) { paginatedPrevious = getClientCertificatesPaginatedURL(RestApiConstants.CLIENT_CERTS_GET_PAGINATED_URL, keyType, paginatedParams.get(RestApiConstants.PAGINATION_PREVIOUS_OFFSET), diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/ApisApi.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/ApisApi.java index 8af77275eddd..a76a7d10400e 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/ApisApi.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/ApisApi.java @@ -100,7 +100,7 @@ public Response addAPIClientCertificate(@ApiParam(value = "**API ID** consisting } @POST - @Path("/{apiId}/client-certificates/v2/{keyType}") + @Path("/{apiId}/client-certs/{keyType}") @Consumes({ "multipart/form-data" }) @Produces({ "application/json" }) @ApiOperation(value = "Upload a New Certificate of the given key type", notes = "This operation can be used to upload a new certificate for an endpoint of the given type. ", response = ClientCertMetadataDTO.class, authorizations = { @@ -419,7 +419,7 @@ public Response deleteAPIClientCertificateByAlias(@ApiParam(value = "The alias o } @DELETE - @Path("/{apiId}/client-certificates/v2/{keyType}/{alias}") + @Path("/{apiId}/client-certs/{keyType}/{alias}") @Produces({ "application/json" }) @ApiOperation(value = "Delete a Certificate of a Given Key Type", notes = "This operation can be used to delete an uploaded certificate of a given key type. ", response = Void.class, authorizations = { @@ -699,7 +699,7 @@ public Response getAPIClientCertificateByAlias(@ApiParam(value = "",required=tru } @GET - @Path("/{apiId}/client-certificates/v2/{keyType}/{alias}") + @Path("/{apiId}/client-certs/{keyType}/{alias}") @Produces({ "application/json" }) @ApiOperation(value = "Get the Certificate Information of a Given Key Type", notes = "This operation can be used to get the information about a certificate of a given key type. ", response = CertificateInfoDTO.class, authorizations = { @@ -741,7 +741,7 @@ public Response getAPIClientCertificateContentByAlias(@ApiParam(value = "**API I } @GET - @Path("/{apiId}/client-certificates/v2/{keyType}/{alias}/content") + @Path("/{apiId}/client-certs/{keyType}/{alias}/content") @Produces({ "application/json" }) @ApiOperation(value = "Download a Certificate of Given Key Type", notes = "This operation can be used to download a certificate which matches the given alias and key type. ", response = Void.class, authorizations = { @@ -782,7 +782,7 @@ public Response getAPIClientCertificates(@ApiParam(value = "**API ID** consistin } @GET - @Path("/{apiId}/client-certificates/v2/{keyType}") + @Path("/{apiId}/client-certs/{keyType}") @Produces({ "application/json" }) @ApiOperation(value = "Retrieve/ Search Uploaded Client Certificates of a given key type", notes = "This operation can be used to retrieve and search the uploaded client certificates of a given key type. ", response = ClientCertificatesDTO.class, authorizations = { @@ -1654,7 +1654,7 @@ public Response updateAPIClientCertificateByAlias( @Size(min=1,max=30)@ApiParam( } @PUT - @Path("/{apiId}/client-certificates/v2/{keyType}/{alias}") + @Path("/{apiId}/client-certs/{keyType}/{alias}") @Consumes({ "multipart/form-data" }) @Produces({ "application/json" }) @ApiOperation(value = "Update a Certificate of a Given Key Type", notes = "This operation can be used to update an uploaded certificate of a given key type. ", response = ClientCertMetadataDTO.class, authorizations = { diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml index 1f4536a16f6a..a1370de98dc1 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml @@ -4554,6 +4554,9 @@ paths: source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://127.0.0.1:9443/api/am/publisher/v4/throttling-policies/api/Platinum"' + ###################################################### + # The "Client Certificates" resource APIs (Deprecated) + ###################################################### /apis/{apiId}/client-certificates: get: tags: @@ -4669,33 +4672,25 @@ paths: "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates"' operationId: addAPIClientCertificate - /apis/{apiId}/client-certificates/v2/{keyType}: - parameters: - - in: path - name: keyType - schema: - type: string - required: true - description: Key type for the certificate + /apis/{apiId}/client-certificates/{alias}: get: + deprecated: true tags: - Client Certificates - summary: Retrieve/ Search Uploaded Client Certificates of a given key type + summary: Get the Certificate Information description: | - This operation can be used to retrieve and search the uploaded client certificates of a given key type. + This operation can be used to get the information about a certificate. parameters: - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - name: alias - in: query - description: Alias for the client certificate + in: path + required: true schema: type: string - $ref: '#/components/parameters/apiId' responses: 200: description: | - OK. Successful response with the list of matching certificate information in the body. + OK. headers: Content-Type: description: | @@ -4705,9 +4700,11 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ClientCertificates' + $ref: '#/components/schemas/CertificateInfo' 400: $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' 500: $ref: '#/components/responses/InternalServerError' security: @@ -4719,43 +4716,47 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates?alias=wso2carbon"' - operationId: getAPIClientCertificatesByKeyType - post: + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: getAPIClientCertificateByAlias + + put: + deprecated: true tags: - Client Certificates - summary: Upload a New Certificate of the given key type + summary: Update a Certificate description: | - This operation can be used to upload a new certificate for an endpoint of the given type. + This operation can be used to update an uploaded certificate. parameters: + - name: alias + in: path + description: Alias for the certificate + required: true + schema: + maxLength: 30 + minLength: 1 + type: string - $ref: '#/components/parameters/apiId' requestBody: content: multipart/form-data: schema: - required: - - alias - - certificate - - tier properties: certificate: type: string description: The certificate that needs to be uploaded. format: binary - alias: - maxLength: 30 - minLength: 1 - type: string - description: Alias for the certificate tier: type: string - description: API tier to which the certificate should be applied. - required: true + description: The tier of the certificate + keyType: + type: string + description: Whether the key type is PRODUCTION or SANDBOX + default: PRODUCTION responses: 200: description: | OK. - The Certificate added successfully. + The Certificate updated successfully. headers: Location: description: | @@ -4773,32 +4774,35 @@ paths: $ref: '#/components/schemas/ClientCertMetadata' 400: $ref: '#/components/responses/BadRequest' + 404: + $ref: '#/components/responses/NotFound' 500: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - apim:api_create - apim:api_manage - - apim:client_certificates_add + - apim:client_certificates_update - apim:client_certificates_manage x-code-samples: - lang: Curl - source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon -F tier=Gold - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates"' - operationId: addAPIClientCertificateOfGivenKeyType + source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon + -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + operationId: updateAPIClientCertificateByAlias - /apis/{apiId}/client-certificates/{alias}: - get: + delete: deprecated: true tags: - Client Certificates - summary: Get the Certificate Information + summary: Delete a Certificate description: | - This operation can be used to get the information about a certificate. + This operation can be used to delete an uploaded certificate. parameters: - name: alias in: path + description: | + The alias of the certificate that should be deleted. required: true schema: type: string @@ -4807,16 +4811,14 @@ paths: 200: description: | OK. + The Certificate deleted successfully. headers: Content-Type: description: | The content type of the body. schema: type: string - content: - application/json: - schema: - $ref: '#/components/schemas/CertificateInfo' + content: {} 400: $ref: '#/components/responses/BadRequest' 404: @@ -4825,69 +4827,41 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apim:api_view + - apim:api_create - apim:api_manage - - apim:client_certificates_view - - apim:client_certificates_manage + - apim:client_certificates_update x-code-samples: - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' - operationId: getAPIClientCertificateByAlias + operationId: deleteAPIClientCertificateByAlias - put: + /apis/{apiId}/client-certificates/{alias}/content: + get: deprecated: true tags: - Client Certificates - summary: Update a Certificate + summary: Download a Certificate description: | - This operation can be used to update an uploaded certificate. + This operation can be used to download a certificate which matches the given alias. parameters: + - $ref: '#/components/parameters/apiId' - name: alias in: path - description: Alias for the certificate required: true schema: - maxLength: 30 - minLength: 1 type: string - - $ref: '#/components/parameters/apiId' - requestBody: - content: - multipart/form-data: - schema: - properties: - certificate: - type: string - description: The certificate that needs to be uploaded. - format: binary - tier: - type: string - description: The tier of the certificate - keyType: - type: string - description: Whether the key type is PRODUCTION or SANDBOX - default: PRODUCTION responses: 200: description: | OK. - The Certificate updated successfully. headers: - Location: - description: | - The URL of the newly created resource. - schema: - type: string Content-Type: description: | The content type of the body. schema: type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ClientCertMetadata' + content: {} 400: $ref: '#/components/responses/BadRequest' 404: @@ -4896,62 +4870,139 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apim:api_create + - apim:api_view - apim:api_manage - - apim:client_certificates_update + - apim:client_certificates_view - apim:client_certificates_manage x-code-samples: - lang: Curl - source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon - -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' - operationId: updateAPIClientCertificateByAlias + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content" > test.crt' + operationId: getAPIClientCertificateContentByAlias - delete: - deprecated: true + ###################################################### + # The "Client Certificates" resource APIs (New) + ###################################################### + /apis/{apiId}/client-certs/{keyType}: + parameters: + - in: path + name: keyType + schema: + type: string + required: true + description: Key type for the certificate + get: tags: - Client Certificates - summary: Delete a Certificate + summary: Retrieve/ Search Uploaded Client Certificates of a given key type description: | - This operation can be used to delete an uploaded certificate. + This operation can be used to retrieve and search the uploaded client certificates of a given key type. parameters: + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' - name: alias - in: path - description: | - The alias of the certificate that should be deleted. - required: true + in: query + description: Alias for the client certificate schema: type: string - $ref: '#/components/parameters/apiId' + responses: + 200: + description: | + OK. Successful response with the list of matching certificate information in the body. + headers: + Content-Type: + description: | + The content type of the body. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertificates' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - OAuth2Security: + - apim:api_view + - apim:api_manage + - apim:client_certificates_view + - apim:client_certificates_manage + x-code-samples: + - lang: Curl + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION?alias=wso2carbon"' + operationId: getAPIClientCertificatesByKeyType + post: + tags: + - Client Certificates + summary: Upload a New Certificate of the given key type + description: | + This operation can be used to upload a new certificate for an endpoint of the given type. + parameters: + - $ref: '#/components/parameters/apiId' + requestBody: + content: + multipart/form-data: + schema: + required: + - alias + - certificate + - tier + properties: + certificate: + type: string + description: The certificate that needs to be uploaded. + format: binary + alias: + maxLength: 30 + minLength: 1 + type: string + description: Alias for the certificate + tier: + type: string + description: API tier to which the certificate should be applied. + required: true responses: 200: description: | OK. - The Certificate deleted successfully. + The Certificate added successfully. headers: + Location: + description: | + The URL of the newly created resource. + schema: + type: string Content-Type: description: | The content type of the body. schema: type: string - content: {} + content: + application/json: + schema: + $ref: '#/components/schemas/ClientCertMetadata' 400: $ref: '#/components/responses/BadRequest' - 404: - $ref: '#/components/responses/NotFound' 500: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - apim:api_create - apim:api_manage - - apim:client_certificates_update + - apim:client_certificates_add + - apim:client_certificates_manage x-code-samples: - lang: Curl - source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' - operationId: deleteAPIClientCertificateByAlias - /apis/{apiId}/client-certificates/v2/{keyType}/{alias}: + source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" + -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon -F tier=Gold + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION"' + operationId: addAPIClientCertificateOfGivenKeyType + + /apis/{apiId}/client-certs/{keyType}/{alias}: parameters: - in: path name: keyType @@ -5001,7 +5052,7 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION/wso2carbon"' operationId: getAPIClientCertificateByKeyTypeAndAlias put: @@ -5068,7 +5119,7 @@ paths: - lang: Curl source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -H "Content-Type: multipart/form-data" -F certificate=@test.crt -F alias=wso2carbon - -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' + -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b -F tier=Gold "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION/wso2carbon"' operationId: updateAPIClientCertificateByKeyTypeAndAlias delete: @@ -5115,52 +5166,7 @@ paths: "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon"' operationId: deleteAPIClientCertificateByKeyTypeAndAlias - - /apis/{apiId}/client-certificates/{alias}/content: - get: - deprecated: true - tags: - - Client Certificates - summary: Download a Certificate - description: | - This operation can be used to download a certificate which matches the given alias. - parameters: - - $ref: '#/components/parameters/apiId' - - name: alias - in: path - required: true - schema: - type: string - responses: - 200: - description: | - OK. - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: {} - 400: - $ref: '#/components/responses/BadRequest' - 404: - $ref: '#/components/responses/NotFound' - 500: - $ref: '#/components/responses/InternalServerError' - security: - - OAuth2Security: - - apim:api_view - - apim:api_manage - - apim:client_certificates_view - - apim:client_certificates_manage - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content" > test.crt' - operationId: getAPIClientCertificateContentByAlias - - /apis/{apiId}/client-certificates/v2/{keyType}/{alias}/content: + /apis/{apiId}/client-certs/{keyType}/{alias}/content: get: tags: - Client Certificates @@ -5207,7 +5213,7 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certificates/wso2carbon/content" > test.crt' + "https://127.0.0.1:9443/api/am/publisher/v4/apis/d48a3412-1b85-49be-99f4-b81a3722ae73/client-certs/PRODUCTION/wso2carbon/content" > test.crt' operationId: getAPIClientCertificateContentByKeyTypeAndAlias diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/RestApiConstants.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/RestApiConstants.java index bcf95830660e..c18551ceffab 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/RestApiConstants.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/RestApiConstants.java @@ -263,7 +263,7 @@ public final class RestApiConstants { public static final String MIGRATION_MODE = "migrationMode"; public static final String CERTS_BASE_PATH = "/certificates"; - public static final String CLIENT_CERTS_BASE_PATH = "/clientCertificates/v2"; + public static final String CLIENT_CERTS_BASE_PATH = "/clientCertificates"; public static final String CERTS_GET_PAGINATED_URL = CERTS_BASE_PATH + "?limit=" + LIMIT_PARAM + "&offset=" + OFFSET_PARAM + QUERY_PARAM; public static final String CLIENT_CERTS_GET_PAGINATED_URL =