/** * Reset MasterSecret for Push Application * * @param pushApplicationID id of {@link PushApplication} * @return updated {@link PushApplication} * * @statuscode 200 The MasterSecret for Push Application reset successfully * @statuscode 404 The requested PushApplication resource does not exist */ @PUT @Path("/{pushAppID}/reset") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response resetMasterSecret(@PathParam("pushAppID") String pushApplicationID) { //PushApplication pushApp = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request)); PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (pushApp != null) { // generate the new 'masterSecret' and apply it: String newMasterSecret = UUID.randomUUID().toString(); pushApp.setMasterSecret(newMasterSecret); logger.info("Invoke service to change master secret of a push application '{}'", pushApp.getPushApplicationID()); pushAppService.updatePushApplication(pushApp); return Response.ok(pushApp).build(); } return Response.status(Status.NOT_FOUND).entity("Could not find requested PushApplicationEntity").build(); }