添加项目访问基础路径.

pull/39/head
chen.ma 4 years ago
parent 0709cb3894
commit 6b680a0cc6

@ -78,14 +78,14 @@ public class GlobalSecurityConfig extends WebSecurityConfigurerAdapter {
public void configure(WebSecurity web) throws Exception { public void configure(WebSecurity web) throws Exception {
String[] ignores = Stream String[] ignores = Stream
.of( .of(
"/v1/cs/apps/renew/**", "/hippo4j/v1/cs/apps/renew/**",
"/v1/cs/apps/remove/**", "/hippo4j/v1/cs/apps/remove/**",
"/v1/cs/apps/register/**", "/hippo4j/v1/cs/apps/register/**",
"/v1/cs/configs/**", "/hippo4j/v1/cs/configs/**",
"/v1/cs/listener/**", "/hippo4j/v1/cs/listener/**",
"/v1/cs/monitor/**", "/hippo4j/v1/cs/monitor/**",
"/v1/cs/health/check/**", "/hippo4j/v1/cs/health/check/**",
"/v1/cs/notify/list/config/**" "/hippo4j/v1/cs/notify/list/config/**"
) )
.toArray(String[]::new); .toArray(String[]::new);
web.ignoring().antMatchers(ignores); web.ignoring().antMatchers(ignores);

@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static cn.hippo4j.auth.constant.Constants.SPLIT_COMMA; import static cn.hippo4j.auth.constant.Constants.SPLIT_COMMA;
import static cn.hippo4j.common.constant.Constants.BASE_PATH;
/** /**
* JWT authentication filter. * JWT authentication filter.
@ -42,7 +43,7 @@ public class JWTAuthenticationFilter extends UsernamePasswordAuthenticationFilte
public JWTAuthenticationFilter(AuthenticationManager authenticationManager) { public JWTAuthenticationFilter(AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager; this.authenticationManager = authenticationManager;
super.setFilterProcessesUrl("/v1/cs/auth/login"); super.setFilterProcessesUrl(BASE_PATH + "/auth/login");
} }
@Override @Override

@ -36,7 +36,7 @@ public class Constants {
public static final String LONG_POLLING_LINE_SEPARATOR = "\r\n"; public static final String LONG_POLLING_LINE_SEPARATOR = "\r\n";
public static final String BASE_PATH = "/v1/cs"; public static final String BASE_PATH = "/hippo4j/v1/cs";
public static final String CONFIG_CONTROLLER_PATH = BASE_PATH + "/configs"; public static final String CONFIG_CONTROLLER_PATH = BASE_PATH + "/configs";

@ -27,6 +27,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static cn.hippo4j.common.constant.Constants.BASE_PATH;
/** /**
* Base send message service. * Base send message service.
* *
@ -122,7 +124,7 @@ public class BaseSendMessageService implements InitializingBean, SendMessageServ
Result result = null; Result result = null;
try { try {
result = httpAgent.httpPostByDiscovery("/v1/cs/notify/list/config", new ThreadPoolNotifyReqDTO(groupKeys)); result = httpAgent.httpPostByDiscovery(BASE_PATH + "/notify/list/config", new ThreadPoolNotifyReqDTO(groupKeys));
} catch (Throwable ex) { } catch (Throwable ex) {
log.error("Get dynamic thread pool notify configuration error.", ex); log.error("Get dynamic thread pool notify configuration error.", ex);
} }

@ -17,7 +17,7 @@ import org.springframework.beans.factory.DisposableBean;
import java.util.Map; import java.util.Map;
import java.util.concurrent.*; import java.util.concurrent.*;
import static cn.hippo4j.common.constant.Constants.GROUP_KEY; import static cn.hippo4j.common.constant.Constants.*;
/** /**
* Discovery client. * Discovery client.
@ -71,7 +71,7 @@ public class DiscoveryClient implements DisposableBean {
boolean register() { boolean register() {
log.info("{}{} - registering service...", PREFIX, appPathIdentifier); log.info("{}{} - registering service...", PREFIX, appPathIdentifier);
String urlPath = Constants.BASE_PATH + "/apps/register/"; String urlPath = BASE_PATH + "/apps/register/";
Result registerResult; Result registerResult;
try { try {
registerResult = httpAgent.httpPostByDiscovery(urlPath, instanceInfo); registerResult = httpAgent.httpPostByDiscovery(urlPath, instanceInfo);
@ -108,7 +108,7 @@ public class DiscoveryClient implements DisposableBean {
log.error("{}{} - remove config cache fail.", PREFIX, appPathIdentifier, ex); log.error("{}{} - remove config cache fail.", PREFIX, appPathIdentifier, ex);
} }
String removeNodeUrlPath = Constants.BASE_PATH + "/apps/remove/"; String removeNodeUrlPath = BASE_PATH + "/apps/remove/";
Result removeNodeResult; Result removeNodeResult;
try { try {
removeNodeResult = httpAgent.httpPostByDiscovery(removeNodeUrlPath, instanceInfo); removeNodeResult = httpAgent.httpPostByDiscovery(removeNodeUrlPath, instanceInfo);
@ -139,7 +139,7 @@ public class DiscoveryClient implements DisposableBean {
.setLastDirtyTimestamp(instanceInfo.getLastDirtyTimestamp().toString()) .setLastDirtyTimestamp(instanceInfo.getLastDirtyTimestamp().toString())
.setStatus(instanceInfo.getStatus().toString()); .setStatus(instanceInfo.getStatus().toString());
renewResult = httpAgent.httpPostByDiscovery(Constants.BASE_PATH + "/apps/renew", instanceRenew); renewResult = httpAgent.httpPostByDiscovery(BASE_PATH + "/apps/renew", instanceRenew);
if (StrUtil.equals(ErrorCodeEnum.NOT_FOUND.getCode(), renewResult.getCode())) { if (StrUtil.equals(ErrorCodeEnum.NOT_FOUND.getCode(), renewResult.getCode())) {
long timestamp = instanceInfo.setIsDirtyWithTime(); long timestamp = instanceInfo.setIsDirtyWithTime();
boolean success = register(); boolean success = register();

Loading…
Cancel
Save