Skip to content

Commit

Permalink
#159 Add notebook.services.communication.token to allow the third-par…
Browse files Browse the repository at this point in the history
…ty service accessing notebook (#163)

* open api secret key is the same with notebook.security.key

* add notebook.service.security.key to allow the third party accessing notebook

* rename notebook.services.security.key to  notebook.services.communication.token
  • Loading branch information
allwefantasy authored Jun 29, 2022
1 parent 94e4e90 commit 06d8f9b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/notebook.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
notebook.port=9002
notebook.session.timeout=12h
notebook.security.key=6173646661736466e4bda0e8bf983161
notebook.services.communication.token=6173646661736466e4bda0e8bf983161

notebook.database.type=mysql
notebook.database.ip=127.0.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ public Boolean getIsTrial(){

public String getSecretKey(){return getOptional("notebook.security.key", "6173646661736466e4bda0e8bf983161");}

public String getServiceSecretKey(){return getOptional("notebook.services.communication.token", getSecretKey());}

public String getOutputSize(){return getOptional("notebook.job.output-size", "1000");}

public String getScheduleCallbackUser(){return getOptional("notebook.scheduler.callback-user", "ByzerRobot");}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Response<NotebookDTO> getNotebook(HttpServletRequest request, @PathVariab
log.info("【NotebookApiService】 /api/service/getNotebook/{} authentication={}", id, authorization);
Claims claims = null;
try {
String secretKey = config.getSecretKey();
String secretKey = config.getServiceSecretKey();
claims = Jwts.parser()
.setSigningKey(secretKey)
.parseClaimsJws(token)
Expand Down

0 comments on commit 06d8f9b

Please sign in to comment.