提交 3f759eb6 编写于 作者: sq3536's avatar sq3536

免登

上级 0538fb01
......@@ -118,11 +118,7 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
.antMatchers("/net-disk/download/**").permitAll()
.antMatchers("/net-disk/edit/**").permitAll()
.antMatchers("/net-disk/ocrview/**").permitAll()
.antMatchers("/net-disk/preview/**").permitAll()
.antMatchers("/net-disk/files/**").permitAll()
.antMatchers("/net-disk/wopi/**").permitAll()
.antMatchers("/net-disk/**view/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
......
......@@ -118,11 +118,7 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
.antMatchers("/net-disk/download/**").permitAll()
.antMatchers("/net-disk/edit/**").permitAll()
.antMatchers("/net-disk/ocrview/**").permitAll()
.antMatchers("/net-disk/preview/**").permitAll()
.antMatchers("/net-disk/files/**").permitAll()
.antMatchers("/net-disk/wopi/**").permitAll();
.antMatchers("/net-disk/**view/**").permitAll();
for (String excludePattern : excludesPattern) {
......
......@@ -129,7 +129,7 @@ public class DiskCoreService {
return getFile("",fileId,"");
}
public File getFile(String folder,String fileId,String authcode) {
if(StringUtils.isEmpty(folder))
if(StringUtils.isEmpty(folder)||folder.equals("download"))
folder = "ibizutil";
if(folder.toLowerCase().startsWith("ibizutil")) {
String dirpath = this.fileRoot.concat(folder).concat(File.separator).concat(fileId.replace("_", File.separator));
......
......@@ -123,11 +123,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
.antMatchers("/net-disk/download/**").permitAll()
.antMatchers("/net-disk/edit/**").permitAll()
.antMatchers("/net-disk/ocrview/**").permitAll()
.antMatchers("/net-disk/preview/**").permitAll()
.antMatchers("/net-disk/files/**").permitAll()
.antMatchers("/net-disk/wopi/**").permitAll();
.antMatchers("/net-disk/**view/**").permitAll();
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
......
......@@ -90,7 +90,7 @@ public class DiskCoreResource
@GetMapping(value = {"net-disk/download/{folder}/{id}/{name}.{ext}","{folder}/download/{id}"})
@GetMapping(value = {"net-disk/download/{folder}/{id}/{name}.{ext}","net-disk/download/{id}","{folder}/download/{id}"})
@ResponseStatus(HttpStatus.OK)
public void download(@PathVariable("folder") String folder, @PathVariable("id") String id,
@PathVariable(value = "name",required = false) String name, @PathVariable(value = "ext", required = false) String ext,
......@@ -101,7 +101,7 @@ public class DiskCoreResource
this.sendRespose(response, file);
}
@GetMapping(value = "net-disk/files/{folder}/{id}/{name}.{ext}")
@GetMapping(value = {"net-disk/openview/{folder}/{id}/{name}.{ext}","net-disk/files/{folder}/{id}/{name}.{ext}"})
@ResponseStatus(HttpStatus.OK)
public void open(@PathVariable("folder") String folder, @PathVariable("id") String id,
@PathVariable("name") String name, @PathVariable("ext") String ext,
......@@ -132,7 +132,7 @@ public class DiskCoreResource
return ResponseEntity.ok().body(true);
}
@Value("ibiz.file.proxy.previewpath:http://172.16.100.243:8012/onlinePreview?url=")
@Value("${ibiz.file.proxy.previewpath:http://172.16.100.243:8012/onlinePreview?url=}")
private String previewPath;
@GetMapping(value = "net-disk/preview/{folder}/{id}/{name}.{ext}")
......@@ -148,13 +148,13 @@ public class DiskCoreResource
String redirectUrl = request.getScheme().concat("://").concat(request.getServerName());
if(request.getServerPort()!=80&&request.getServerPort()!=443)
redirectUrl=redirectUrl.concat(":").concat(request.getServerPort()+"");
redirectUrl=redirectUrl.concat("/net-disk/download/")
redirectUrl=redirectUrl.concat("/net-disk/openview/")
.concat(folder).concat("/").concat(id).concat("/").concat(name).concat(".").concat(ext).concat("?authcode=").concat(StringUtils.isEmpty(authcode)?checkcode:authcode);
redirectUrl=previewPath.concat("").concat(encodeURIComponent(redirectUrl));
return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).header(HttpHeaders.LOCATION, redirectUrl).build();
}
@Value("ibiz.file.proxy.ocrpath:http://101.132.236.47:58114/ocr/view?url=")
@Value("${ibiz.file.proxy.ocrpath:http://101.132.236.47:58114/ocr/view?url=}")
private String ocrPath;
@GetMapping(value = "net-disk/ocrview/{folder}/{id}/{name}.{ext}")
......@@ -172,16 +172,16 @@ public class DiskCoreResource
String redirectUrl = request.getScheme().concat("://").concat(request.getServerName());
if(request.getServerPort()!=80&&request.getServerPort()!=443)
redirectUrl=redirectUrl.concat(":").concat(request.getServerPort()+"");
redirectUrl=redirectUrl.concat("/net-disk/download/")
redirectUrl=redirectUrl.concat("/net-disk/openview/")
.concat(folder).concat("/").concat(id).concat("/").concat(name).concat(".").concat(ext).concat("?authcode=").concat(StringUtils.isEmpty(authcode)?checkcode:authcode);
redirectUrl=ocrPath.concat("").concat(encodeURIComponent(redirectUrl));
return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).header(HttpHeaders.LOCATION, redirectUrl).build();
}
@Value("ibiz.file.proxy.editpath:http://172.16.180.233:9980/loleaflet/dist/loleaflet.html?file_path=")
@Value("${ibiz.file.proxy.editpath:http://172.16.180.233:9980/loleaflet/dist/loleaflet.html?file_path=}")
private String editPath;
@GetMapping(value = "net-disk/edit/{folder}/{id}/{name}.{ext}")
@GetMapping(value = {"net-disk/editview/{folder}/{id}/{name}.{ext}","net-disk/edit/{folder}/{id}/{name}.{ext}"})
public ResponseEntity editview(@PathVariable("folder") String folder, @PathVariable("id") String id,
@PathVariable("name") String name, @PathVariable("ext") String ext,
@RequestHeader(value = "authcode",required = false) String authcode,
......@@ -196,13 +196,13 @@ public class DiskCoreResource
String redirectUrl = request.getScheme().concat("://").concat(request.getServerName());
if(request.getServerPort()!=80&&request.getServerPort()!=443)
redirectUrl=redirectUrl.concat(":").concat(request.getServerPort()+"");
redirectUrl=redirectUrl.concat("/net-disk/wopi/")
redirectUrl=redirectUrl.concat("/net-disk/wopiview/")
.concat(folder).concat("/").concat(id).concat("/").concat(encodeURIComponent(name)).concat(".").concat(ext);
redirectUrl=editPath.concat("").concat(redirectUrl);
return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).header(HttpHeaders.LOCATION, redirectUrl).build();
}
@GetMapping(value = "net-disk/wopi/{folder}/{id}/{name}.{ext}")
@GetMapping(value = "net-disk/wopiview/{folder}/{id}/{name}.{ext}")
public ResponseEntity<JSONObject> getWoAPI(@PathVariable("folder") String folder, @PathVariable("id") String id,
@PathVariable(value = "name",required = false) String name, @PathVariable(value = "ext", required = false) String ext){
......@@ -225,7 +225,7 @@ public class DiskCoreResource
return ResponseEntity.ok().body(json);
}
@GetMapping(value = "net-disk/wopi/{folder}/{id}/{name}.{ext}/contents")
@GetMapping(value = "net-disk/wopiview/{folder}/{id}/{name}.{ext}/contents")
@ResponseStatus(HttpStatus.OK)
public void getWoAPIContents(@PathVariable("folder") String folder, @PathVariable("id") String id,
@PathVariable(value = "name",required = false) String name, @PathVariable(value = "ext", required = false) String ext, HttpServletResponse response) {
......@@ -272,7 +272,7 @@ public class DiskCoreResource
}
}
@PostMapping("net-disk/wopi/{folder}/{id}/{name}.{ext}/contents")
@PostMapping("net-disk/wopiview/{folder}/{id}/{name}.{ext}/contents")
@ResponseStatus(HttpStatus.OK)
public void postWoAPIFile(@PathVariable("folder") String folder, @PathVariable("id") String id,
@PathVariable(value = "name",required = false) String name, @PathVariable(value = "ext", required = false) String ext, @RequestBody byte[] content) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册