diff --git a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java index 5814cf869a..7ef294f998 100644 --- a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java +++ b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java @@ -685,14 +685,18 @@ public Message getUserKeyValue( parms.put("nonce", SHAUtils.DOCTOR_NONCE); // doctor提供的token String token = SHAUtils.DOCTOR_TOKEN.getValue(); - String signature = - SHAUtils.Encrypt( - SHAUtils.Encrypt( - parms.get("app_id") + SHAUtils.DOCTOR_NONCE + System.currentTimeMillis(), null) - + token, - null); - parms.put("signature", signature); - return Message.ok().data("doctor", parms); + if (StringUtils.isNotBlank(token)){ + String signature = + SHAUtils.Encrypt( + SHAUtils.Encrypt( + parms.get("app_id") + SHAUtils.DOCTOR_NONCE + System.currentTimeMillis(), null) + + token, + null); + parms.put("signature", signature); + return Message.ok().data("doctor", parms); + } else { + return Message.error("Doctor token cannot be empty"); + } } @ApiOperation(