|
@@ -51,28 +51,30 @@ public class ObjectUploadController {
|
|
|
|
|
|
|
|
@AuthUser
|
|
@AuthUser
|
|
|
@PostMapping(value = "/")
|
|
@PostMapping(value = "/")
|
|
|
- public String postObject(MultipartFile file, String objectName, String sha256sum, Integer channelId) throws Exception {
|
|
|
|
|
|
|
+ public String postObject(MultipartFile file, Integer channelId, String client) throws Exception {
|
|
|
/* permission check */
|
|
/* permission check */
|
|
|
- String token = ServletUtil.getBearerToken();
|
|
|
|
|
- if (token == null) {
|
|
|
|
|
- return WebResult.failWithMsg("no token in request");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (client == null) {
|
|
|
|
|
+ String token = ServletUtil.getBearerToken();
|
|
|
|
|
+ if (token == null) {
|
|
|
|
|
+ return WebResult.failWithMsg("no token in request");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- OssPayload ossPayload = JwtUtil.getOssPayload(token);
|
|
|
|
|
- String action = ossPayload.getAction();
|
|
|
|
|
- if (!"upload".equals(action)) {
|
|
|
|
|
- return WebResult.failWithMsg("it's not upload token");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ OssPayload ossPayload = JwtUtil.getOssPayload(token);
|
|
|
|
|
+ String action = ossPayload.getAction();
|
|
|
|
|
+ if (!"upload".equals(action)) {
|
|
|
|
|
+ return WebResult.failWithMsg("it's not upload token");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- int channelId1 = ossPayload.getChannelId();
|
|
|
|
|
- if (channelId != channelId1) {
|
|
|
|
|
- return WebResult.failWithMsg("channel not match in token");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ int channelId1 = ossPayload.getChannelId();
|
|
|
|
|
+ if (channelId != channelId1) {
|
|
|
|
|
+ return WebResult.failWithMsg("channel not match in token");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- long userId1 = ossPayload.getUserId();
|
|
|
|
|
- long userId = UserContext.getUser();
|
|
|
|
|
- if (userId != userId1) {
|
|
|
|
|
- return WebResult.failWithMsg("user not match in token");
|
|
|
|
|
|
|
+ long userId1 = ossPayload.getUserId();
|
|
|
|
|
+ long loginUser = UserContext.getUser();
|
|
|
|
|
+ if (loginUser != userId1) {
|
|
|
|
|
+ return WebResult.failWithMsg("user not match in token");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* channel validate */
|
|
/* channel validate */
|