调整微信登录
This commit is contained in:
parent
e9d8315ef0
commit
e119931fb4
@ -23,7 +23,6 @@ public class WechatMiniAppProperties {
|
|||||||
private String grantType;
|
private String grantType;
|
||||||
private String appKey;
|
private String appKey;
|
||||||
private String appSecret;
|
private String appSecret;
|
||||||
private String configToken;
|
|
||||||
|
|
||||||
public Boolean getActive() {
|
public Boolean getActive() {
|
||||||
return active;
|
return active;
|
||||||
@ -73,14 +72,6 @@ public class WechatMiniAppProperties {
|
|||||||
this.appSecret = appSecret;
|
this.appSecret = appSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConfigToken() {
|
|
||||||
return configToken == null ? "" : configToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConfigToken(String configToken) {
|
|
||||||
this.configToken = configToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder("{");
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
@ -96,8 +87,6 @@ public class WechatMiniAppProperties {
|
|||||||
.append(appKey).append('\"');
|
.append(appKey).append('\"');
|
||||||
sb.append(",\"appSecret\":\"")
|
sb.append(",\"appSecret\":\"")
|
||||||
.append(appSecret).append('\"');
|
.append(appSecret).append('\"');
|
||||||
sb.append(",\"configToken\":\"")
|
|
||||||
.append(configToken).append('\"');
|
|
||||||
sb.append('}');
|
sb.append('}');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,14 @@ public class WechatMiniAppFilter implements Filter {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WechatMiniAppFilter.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WechatMiniAppFilter.class);
|
||||||
private AntPathMatcher antPathMatcher;
|
private AntPathMatcher antPathMatcher;
|
||||||
|
/**
|
||||||
private static final String WECHAT_MINI_APP_LOGIN_URL = String.format("/**%s/auth/login", ISystemConstant.WECHAT_MINI_APP_PREFIX);
|
* 授权登录
|
||||||
|
*/
|
||||||
|
private static final String WECHAT_MINI_APP_AUTH_LOGIN_URL = String.format("/**%s/auth/login", ISystemConstant.WECHAT_MINI_APP_PREFIX);
|
||||||
|
/**
|
||||||
|
* 认证登录
|
||||||
|
*/
|
||||||
|
private static final String WECHAT_MINI_APP_SIGN_LOGIN_URL = String.format("/**%s/sign/login", ISystemConstant.WECHAT_MINI_APP_PREFIX);
|
||||||
/**
|
/**
|
||||||
* 微信类放行
|
* 微信类放行
|
||||||
*/
|
*/
|
||||||
@ -57,9 +63,10 @@ public class WechatMiniAppFilter implements Filter {
|
|||||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||||
|
|
||||||
String requestUri = request.getRequestURI();
|
String requestUri = request.getRequestURI();
|
||||||
boolean isLogin = antPathMatcher.match(WECHAT_MINI_APP_LOGIN_URL, requestUri);
|
boolean isLogin = antPathMatcher.match(WECHAT_MINI_APP_AUTH_LOGIN_URL, requestUri) ||
|
||||||
|
antPathMatcher.match(WECHAT_MINI_APP_SIGN_LOGIN_URL, requestUri);
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@ public class WechatMiniAppAuthServiceImpl implements IWechatMiniAppAuthService {
|
|||||||
if (wechatMiniAppProperties == null) {
|
if (wechatMiniAppProperties == null) {
|
||||||
throw new SystemException("未有相关配置");
|
throw new SystemException("未有相关配置");
|
||||||
}
|
}
|
||||||
|
if (wechatMiniAppProperties.getActive() == null || !wechatMiniAppProperties.getActive()) {
|
||||||
|
throw new SystemException("未激活小程序配置");
|
||||||
|
}
|
||||||
Map<String, Object> params = new HashMap<>(2);
|
Map<String, Object> params = new HashMap<>(2);
|
||||||
params.put("appid", wechatMiniAppProperties.getAppKey());
|
params.put("appid", wechatMiniAppProperties.getAppKey());
|
||||||
params.put("secret", wechatMiniAppProperties.getAppSecret());
|
params.put("secret", wechatMiniAppProperties.getAppSecret());
|
||||||
|
Loading…
Reference in New Issue
Block a user