Unverified Commit c3c35e84 authored by ZackYoung's avatar ZackYoung Committed by GitHub

remove_task_config_field (#2194)

parent a497d7e5
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
package org.dinky.configure; package org.dinky.configure;
import org.dinky.data.annotation.PublicInterface;
import org.dinky.data.constant.BaseConstant; import org.dinky.data.constant.BaseConstant;
import org.dinky.interceptor.LocaleChangeInterceptor; import org.dinky.interceptor.LocaleChangeInterceptor;
import org.dinky.interceptor.TenantInterceptor; import org.dinky.interceptor.TenantInterceptor;
...@@ -28,7 +27,6 @@ import java.util.Locale; ...@@ -28,7 +27,6 @@ import java.util.Locale;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
...@@ -105,18 +103,7 @@ public class AppConfig implements WebMvcConfigurer { ...@@ -105,18 +103,7 @@ public class AppConfig implements WebMvcConfigurer {
// .excludePathPatterns("/druid/**") // .excludePathPatterns("/druid/**")
// .excludePathPatterns("/openapi/**"); // .excludePathPatterns("/openapi/**");
registry.addInterceptor( registry.addInterceptor(new SaInterceptor(handler -> StpUtil.checkLogin()))
new SaInterceptor(
handler -> {
if (handler instanceof HandlerMethod) {
if (((HandlerMethod) handler)
.getMethodAnnotation(PublicInterface.class)
!= null) {
return;
}
StpUtil.checkLogin();
}
}))
.addPathPatterns("/api/**") .addPathPatterns("/api/**")
.excludePathPatterns( .excludePathPatterns(
"/api/login", "/api/ldap/ldapEnableStatus", "/api/login", "/api/ldap/ldapEnableStatus",
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
package org.dinky.controller; package org.dinky.controller;
import org.dinky.data.annotation.Log; import org.dinky.data.annotation.Log;
import org.dinky.data.annotation.PublicInterface;
import org.dinky.data.dto.GitProjectDTO; import org.dinky.data.dto.GitProjectDTO;
import org.dinky.data.dto.TreeNodeDTO; import org.dinky.data.dto.TreeNodeDTO;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
...@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit; ...@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -227,8 +225,6 @@ public class GitController { ...@@ -227,8 +225,6 @@ public class GitController {
* @return {@link Result} of {@link Void} * @return {@link Result} of {@link Void}
*/ */
@GetMapping(path = "/build-step-logs", produces = MediaType.TEXT_EVENT_STREAM_VALUE) @GetMapping(path = "/build-step-logs", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
@CrossOrigin("*")
@PublicInterface
@Log(title = "GitProject Build Step Logs", businessType = BusinessType.QUERY) @Log(title = "GitProject Build Step Logs", businessType = BusinessType.QUERY)
@ApiOperation("GitProject Build Step Logs") @ApiOperation("GitProject Build Step Logs")
public SseEmitter buildStepLogs(@RequestParam("id") Integer id) { public SseEmitter buildStepLogs(@RequestParam("id") Integer id) {
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
package org.dinky.controller; package org.dinky.controller;
import org.dinky.data.annotation.Log; import org.dinky.data.annotation.Log;
import org.dinky.data.annotation.PublicInterface;
import org.dinky.data.dto.MetricsLayoutDTO; import org.dinky.data.dto.MetricsLayoutDTO;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.model.Metrics; import org.dinky.data.model.Metrics;
...@@ -65,7 +64,6 @@ public class MonitorController { ...@@ -65,7 +64,6 @@ public class MonitorController {
} }
@GetMapping(value = "/getLastUpdateData", produces = MediaType.TEXT_EVENT_STREAM_VALUE) @GetMapping(value = "/getLastUpdateData", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
@PublicInterface
@ApiOperation("Get Last Update Data") @ApiOperation("Get Last Update Data")
public SseEmitter getLastUpdateData(Long lastTime) { public SseEmitter getLastUpdateData(Long lastTime) {
SseEmitter emitter = new SseEmitterUTF8(TimeUnit.MINUTES.toMillis(30)); SseEmitter emitter = new SseEmitterUTF8(TimeUnit.MINUTES.toMillis(30));
......
...@@ -19,14 +19,12 @@ ...@@ -19,14 +19,12 @@
package org.dinky.controller; package org.dinky.controller;
import org.dinky.data.annotation.PublicInterface;
import org.dinky.service.MonitorService; import org.dinky.service.MonitorService;
import org.dinky.sse.SseEmitterUTF8; import org.dinky.sse.SseEmitterUTF8;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -44,8 +42,6 @@ public class SseController { ...@@ -44,8 +42,6 @@ public class SseController {
private final MonitorService monitorService; private final MonitorService monitorService;
@GetMapping(value = "/getLastUpdateData", produces = MediaType.TEXT_EVENT_STREAM_VALUE) @GetMapping(value = "/getLastUpdateData", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
@CrossOrigin("*")
@PublicInterface
@ApiOperation("Get Last Update Data") @ApiOperation("Get Last Update Data")
public SseEmitter getLastUpdateData(Long lastTime) { public SseEmitter getLastUpdateData(Long lastTime) {
SseEmitter emitter = new SseEmitterUTF8(TimeUnit.MINUTES.toMillis(30)); SseEmitter emitter = new SseEmitterUTF8(TimeUnit.MINUTES.toMillis(30));
...@@ -54,8 +50,6 @@ public class SseController { ...@@ -54,8 +50,6 @@ public class SseController {
} }
@GetMapping(value = "/getJvmInfo", produces = MediaType.TEXT_EVENT_STREAM_VALUE) @GetMapping(value = "/getJvmInfo", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
@CrossOrigin("*")
@PublicInterface
@ApiOperation("Get JVM Info") @ApiOperation("Get JVM Info")
public SseEmitter getJvmInfo(Long lastTime) { public SseEmitter getJvmInfo(Long lastTime) {
SseEmitter emitter = new SseEmitterUTF8(TimeUnit.MINUTES.toMillis(30)); SseEmitter emitter = new SseEmitterUTF8(TimeUnit.MINUTES.toMillis(30));
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PublicInterface {}
...@@ -21,17 +21,14 @@ package org.dinky.interceptor; ...@@ -21,17 +21,14 @@ package org.dinky.interceptor;
import org.dinky.assertion.Asserts; import org.dinky.assertion.Asserts;
import org.dinky.context.TenantContextHolder; import org.dinky.context.TenantContextHolder;
import org.dinky.data.annotation.PublicInterface;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.AsyncHandlerInterceptor; import org.springframework.web.servlet.AsyncHandlerInterceptor;
import cn.dev33.satoken.SaManager; import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.exception.NotLoginException;
import cn.hutool.core.lang.Opt; import cn.hutool.core.lang.Opt;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -62,14 +59,6 @@ public class TenantInterceptor implements AsyncHandlerInterceptor { ...@@ -62,14 +59,6 @@ public class TenantInterceptor implements AsyncHandlerInterceptor {
} }
} }
} }
if (!isPass) {
if (handler instanceof HandlerMethod) {
if (((HandlerMethod) handler).getMethodAnnotation(PublicInterface.class) != null) {
return true;
}
}
throw new NotLoginException("请先登录", "login", "login");
}
return AsyncHandlerInterceptor.super.preHandle(request, response, handler); return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment