From 09aae93fc13b0679e94e28a7786a227b2be567e3 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Thu, 12 Jan 2017 18:34:11 +0530 Subject: [PATCH] Adding perm:admin:certificates:verify scope --- .../CertificateManagementAdminService.java | 98 ++++--------------- .../devicemgt/app/conf/config.json | 1 + 2 files changed, 18 insertions(+), 81 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index 14d06f00f04..1bf6448876e 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -64,6 +64,12 @@ import javax.ws.rs.core.Response; description = "Deleting an SSL Certificate", key = "perm:admin:certificates:delete", permissions = {"/device-mgt/admin/certificates/delete"} + ), + @Scope( + name = "Verifying an SSL Certificate", + description = "Verifying an SSL Certificate", + key = "perm:admin:certificates:verify", + permissions = {"/device-mgt/admin/certificates/verify"} ) } ) @@ -338,84 +344,8 @@ public interface CertificateManagementAdminService { defaultValue = "12438035315552875930") @PathParam("serialNumber") String serialNumber); -// /** -// * Verify IOS Certificate for the API security filter -// * -// * @param certificate to be verified as a String -// * @return Status of the certificate verification. -// */ -// @POST -// @Path("/verify/ios") -// @ApiOperation( -// consumes = MediaType.APPLICATION_JSON, -// produces = MediaType.APPLICATION_JSON, -// httpMethod = "POST", -// value = "Verify IOS SSL certificate", -// notes = "Verify IOS Certificate for the API security filter.\n", -// tags = "Certificate Management") -// @ApiResponses( -// value = { -// @ApiResponse( -// code = 200, -// message = "Return the status of the IOS certificate verification.", -// responseHeaders = { -// @ResponseHeader( -// name = "Content-Type", -// description = "The content type of the body")}), -// @ApiResponse( -// code = 400, -// message = "Bad Request. \n Invalid request or validation error.", -// response = ErrorResponse.class) -// }) -// Response verifyIOSCertificate( -// @ApiParam( -// name = "certificate", -// value = "The properties to verify certificate. It includes the following: \n" + -// "serial: The unique ID of the certificate. (optional) \n" + -// "pem: mdm-signature of the certificate", -// required = true) EnrollmentCertificate certificate); -// -// /** -// * Verify Android Certificate for the API security filter -// * -// * @param certificate to be verified as a String -// * @return Status of the certificate verification. -// */ -// @POST -// @Path("/verify/android") -// @ApiOperation( -// consumes = MediaType.APPLICATION_JSON, -// produces = MediaType.APPLICATION_JSON, -// httpMethod = "POST", -// value = "Verify Android SSL certificate", -// notes = "Verify Android Certificate for the API security filter.\n", -// tags = "Certificate Management") -// @ApiResponses( -// value = { -// @ApiResponse( -// code = 200, -// message = "Return the status of the Android certificate verification.", -// responseHeaders = { -// @ResponseHeader( -// name = "Content-Type", -// description = "The content type of the body")}), -// @ApiResponse( -// code = 400, -// message = "Bad Request. \n Invalid request or validation error.", -// response = ErrorResponse.class) -// }) -// Response verifyAndroidCertificate( -// @ApiParam( -// name = "certificate", -// value = "The properties to verify certificate. It includes the following: \n" + -// "serial: The unique ID of the certificate. (optional) \n" + -// "pem: pem String of the certificate", -// required = true) EnrollmentCertificate certificate); -// - - /** - * Verify Android Certificate for the API security filter + * Verify Certificate for the API security filter * * @param certificate to be verified as a String * @return Status of the certificate verification. @@ -426,14 +356,20 @@ public interface CertificateManagementAdminService { consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "POST", - value = "Verify Android SSL certificate", - notes = "Verify Android Certificate for the API security filter.\n", - tags = "Certificate Management") + value = "Verify SSL certificate", + notes = "Verify Certificate for the API security filter.\n", + tags = "Certificate Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:verify") + }) + } + ) @ApiResponses( value = { @ApiResponse( code = 200, - message = "Return the status of the Android certificate verification.", + message = "Return the status of the certificate verification.", responseHeaders = { @ResponseHeader( name = "Content-Type", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 686dafbe2e2..b944b2fa451 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -140,6 +140,7 @@ "perm:admin:certificates:details", "perm:admin:certificates:view", "perm:admin:certificates:add", + "perm:admin:certificates:verify", "perm:admin" ], "isOAuthEnabled" : true,