广西联通bug解决
This commit is contained in:
parent
9802f3e78a
commit
9c8318eb4e
@ -307,7 +307,7 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
|
|||||||
// 如果config type = 1 获取token
|
// 如果config type = 1 获取token
|
||||||
Map<String, Object> data = new HashMap<>();
|
Map<String, Object> data = new HashMap<>();
|
||||||
List<EntityMap> videoList = videoItemMapper.selectProjectVideoList(map);
|
List<EntityMap> videoList = videoItemMapper.selectProjectVideoList(map);
|
||||||
if (videoList.size() > 0) {
|
if (videoList.size() > 0 && "1".equals(MapUtils.getString(videoList.get(0), "videoType"))) {
|
||||||
String token = YsVideoUtil.getToken(MapUtils.getString(videoList.get(0), "appId"), MapUtils.getString(videoList.get(0), "appSecret"));
|
String token = YsVideoUtil.getToken(MapUtils.getString(videoList.get(0), "appId"), MapUtils.getString(videoList.get(0), "appSecret"));
|
||||||
for (EntityMap entityMap : videoList) {
|
for (EntityMap entityMap : videoList) {
|
||||||
entityMap.put("token", token);
|
entityMap.put("token", token);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.security;
|
package com.zhgd.xmgl.security;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.util.ProfileJudgeUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -42,6 +43,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
@Value("${security.enable}")
|
@Value("${security.enable}")
|
||||||
private boolean securityEnable;
|
private boolean securityEnable;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ProfileJudgeUtil profileJudgeUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public WebSecurityConfig(JwtAuthenticationEntryPoint unauthorizedHandler,
|
public WebSecurityConfig(JwtAuthenticationEntryPoint unauthorizedHandler,
|
||||||
@Qualifier("RestAuthenticationAccessDeniedHandler") AccessDeniedHandler accessDeniedHandler,
|
@Qualifier("RestAuthenticationAccessDeniedHandler") AccessDeniedHandler accessDeniedHandler,
|
||||||
@ -66,6 +70,12 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.headers().frameOptions().disable();
|
http.headers().frameOptions().disable();
|
||||||
if (securityEnable) {
|
if (securityEnable) {
|
||||||
|
if (profileJudgeUtil.isGxlt()) {
|
||||||
|
http.authorizeRequests()
|
||||||
|
//请求路径允许访问
|
||||||
|
.antMatchers("/xmgl/project/getProjectInfoBySn").permitAll();
|
||||||
|
}
|
||||||
|
|
||||||
http.authorizeRequests()
|
http.authorizeRequests()
|
||||||
//请求路径允许访问
|
//请求路径允许访问
|
||||||
.antMatchers("/xmgl/base/**").permitAll()
|
.antMatchers("/xmgl/base/**").permitAll()
|
||||||
@ -229,6 +239,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.and()
|
.and()
|
||||||
// 定制我们自己的 session 策略:调整为让 Spring Security 不创建和使用 session
|
// 定制我们自己的 session 策略:调整为让 Spring Security 不创建和使用 session
|
||||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
|
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
|
||||||
|
|
||||||
|
|
||||||
//以下这句就可以控制单个用户只能创建一个session,也就只能在服务器登录一次
|
//以下这句就可以控制单个用户只能创建一个session,也就只能在服务器登录一次
|
||||||
//http.sessionManagement().maximumSessions(1).expiredUrl("/login");
|
//http.sessionManagement().maximumSessions(1).expiredUrl("/login");
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.util;
|
package com.zhgd.xmgl.util;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ import java.util.stream.Stream;
|
|||||||
* 环境判断
|
* 环境判断
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
public class ProfileJudgeUtil {
|
public class ProfileJudgeUtil {
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String activeProfile;
|
private String activeProfile;
|
||||||
@ -67,5 +69,22 @@ public class ProfileJudgeUtil {
|
|||||||
return "ylww".equals(activeProfile);
|
return "ylww".equals(activeProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否广西联通生产环境
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isGxltProd() {
|
||||||
|
return "gxlt".equals(activeProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否广西联通环境
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isGxlt() {
|
||||||
|
return Stream.of("gxlt", "gxlt-gsx").anyMatch(s -> s.equals(activeProfile));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,8 +17,8 @@ public class SjUnifiedAuthenticationHttpUtil {
|
|||||||
@Value("${sj.unifiedAuthentication.login.url:}")
|
@Value("${sj.unifiedAuthentication.login.url:}")
|
||||||
private String sjUnifiedAuthenticationLoginUrl;
|
private String sjUnifiedAuthenticationLoginUrl;
|
||||||
|
|
||||||
@Value("${sj.unifiedAuthentication.login.code.url:}")
|
//@Value("${sj.unifiedAuthentication.login.code.url:}")
|
||||||
private String sjUnifiedAuthenticationLoginCodeUrl;
|
//private String sjUnifiedAuthenticationLoginCodeUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 令牌检验
|
* 令牌检验
|
||||||
@ -46,14 +46,14 @@ public class SjUnifiedAuthenticationHttpUtil {
|
|||||||
/**
|
/**
|
||||||
* 获取授权码,重定向
|
* 获取授权码,重定向
|
||||||
*/
|
*/
|
||||||
public void getCodeRedirect(HttpServletResponse response) throws IOException {
|
//public void getCodeRedirect(HttpServletResponse response) throws IOException {
|
||||||
//获取授权码,客户端申请授权的URI,在浏览器中以GET请求发送到认证服务器:
|
// //获取授权码,客户端申请授权的URI,在浏览器中以GET请求发送到认证服务器:
|
||||||
String redirectLoginUrl = sjUnifiedAuthenticationLoginUrl + "/oauth2/authorize?client_id=EuPYxx1mTw-0JIA47wBYww&response_type=code" +
|
// String redirectLoginUrl = sjUnifiedAuthenticationLoginUrl + "/oauth2/authorize?client_id=EuPYxx1mTw-0JIA47wBYww&response_type=code" +
|
||||||
"&redirect_uri=" + sjUnifiedAuthenticationLoginCodeUrl + "&scope=user.read";
|
// "&redirect_uri=" + sjUnifiedAuthenticationLoginCodeUrl + "&scope=user.read";
|
||||||
log.info("getCode重定向的url:{}", sjUnifiedAuthenticationLoginCodeUrl);
|
// log.info("getCode重定向的url:{}", sjUnifiedAuthenticationLoginCodeUrl);
|
||||||
// 将data数据进行响应
|
// // 将data数据进行响应
|
||||||
response.sendRedirect(redirectLoginUrl);
|
// response.sendRedirect(redirectLoginUrl);
|
||||||
}
|
//}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取令牌
|
* 获取令牌
|
||||||
|
|||||||
@ -85,9 +85,9 @@ c2_orguser_subscription=true
|
|||||||
#\u4E09\u6C5F\u7EDF\u4E00\u767B\u5F55\u5730\u5740
|
#\u4E09\u6C5F\u7EDF\u4E00\u767B\u5F55\u5730\u5740
|
||||||
sj.unifiedAuthentication.login.url=http://116.169.63.183:30913
|
sj.unifiedAuthentication.login.url=http://116.169.63.183:30913
|
||||||
#\u4E09\u6C5F\u7EDF\u4E00\u767B\u5F55\u6210\u529F\u8DF3\u8F6C\u540E\u63A5\u6536code\u7684\u5730\u5740
|
#\u4E09\u6C5F\u7EDF\u4E00\u767B\u5F55\u6210\u529F\u8DF3\u8F6C\u540E\u63A5\u6536code\u7684\u5730\u5740
|
||||||
sj.unifiedAuthentication.login.code.url=http://wbtqry.natappfree.cc/xmgl/sj/unifiedAuthentication/getTokenByCode
|
#sj.unifiedAuthentication.login.code.url=http://wbtqry.natappfree.cc/xmgl/sj/unifiedAuthentication/getTokenByCode
|
||||||
#\u7EDF\u4E00\u767B\u5F55\u6210\u529F\u540E\u8DF3\u8F6Curl
|
#\u7EDF\u4E00\u767B\u5F55\u6210\u529F\u540E\u8DF3\u8F6Curl
|
||||||
sj.unifiedAuthentication.success.redirect=http://192.168.34.150:8080/index.html#/login?UID=
|
sj.unifiedAuthentication.success.redirect=http://192.168.34.226:8080/index.html#/login?UID=
|
||||||
|
|
||||||
|
|
||||||
sj.upload.image.url=http://192.168.34.221:11111/image/
|
sj.upload.image.url=http://192.168.34.221:11111/image/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user