tanghc 5 years ago
parent f3575a6add
commit 57f272df94
  1. 4
      sop-admin/sop-admin-server/pom.xml
  2. 6
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/common/WebContext.java
  3. 9
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/config/WebConfig.java
  4. 24
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/controller/IndexController.java
  5. 2
      sop-admin/sop-admin-server/src/main/resources/application-dev.properties

@ -41,8 +41,8 @@
<!-- easyopen starter -->
<dependency>
<groupId>net.oschina.durcframework</groupId>
<artifactId>easyopen</artifactId>
<version>1.16.5</version>
<artifactId>easyopen-spring-boot-starter</artifactId>
<version>1.16.6.1</version>
</dependency>
<dependency>

@ -26,11 +26,11 @@ public class WebContext {
*/
public AdminUserInfo getLoginUser() {
String sessionId = getSessionId();
HttpSession session = getSessionManager().getSession(sessionId);
if (session == null) {
if (sessionId == null) {
return null;
}
if (!session.getId().equals(sessionId)) {
HttpSession session = getSessionManager().getSession(sessionId);
if (session == null) {
return null;
}
return (AdminUserInfo) session.getAttribute(S_USER);

@ -14,14 +14,11 @@ import com.gitee.sop.adminserver.service.impl.RegistryServiceEurekaImpl;
import com.gitee.sop.adminserver.service.impl.RegistryServiceNacosImpl;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
@ -36,9 +33,6 @@ public class WebConfig {
@Value("${admin.access-token.timeout-minutes}")
private String accessTokenTimeout;
@Autowired
private Environment environment;
@Bean
ApiConfig apiConfig() {
ApiConfig apiConfig = new ApiConfig();
@ -93,8 +87,5 @@ public class WebConfig {
return new RegistryServiceEurekaImpl();
}
@PostConstruct
public void after() {
}
}

@ -1,24 +0,0 @@
package com.gitee.sop.adminserver.controller;
import com.gitee.easyopen.ApiConfig;
import com.gitee.easyopen.support.ApiController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* api入口
*/
@Controller
@RequestMapping("api")
public class IndexController extends ApiController {
@Value("${easyopen.show-doc:false}")
private String showDoc;
@Override
protected void initApiConfig(ApiConfig apiConfig) {
apiConfig.setShowDoc(Boolean.valueOf(showDoc));
apiConfig.setIgnoreValidate(true);
}
}

@ -11,7 +11,7 @@ mysql.password=root
nacos.url=127.0.0.1:8848
# ------- 需要改的配置end -------
# token过期时间,分钟
# session过期时间,分钟
admin.access-token.timeout-minutes=30
# 签名方式,rsa:支付宝开放平台签名方式,md5:淘宝开放平台签名方式
sop.sign-type=rsa

Loading…
Cancel
Save