调整过滤内容

This commit is contained in:
wenc000 2020-03-10 22:46:01 +08:00
parent e1ae1eac2c
commit 3d86c6f36f
2 changed files with 13 additions and 2 deletions

View File

@ -56,6 +56,14 @@ public class WechatFilter implements Filter {
* 微信路由放行
*/
private static final String WECHAT_ROUTE_RELEASE_URL = "/**/wechatroute/**/**release/**";
/**
* 微信路由静态资源
*/
private static final String WECHAT_ROUTE_STATIC_URL = "/**/wechatroute/static/**";
/**
* 上传文件
*/
private static final String WECHAT_ROUTE_HYBRID_URL = "/**/wechatroute/hybrid/**";
@Override
public void init(FilterConfig filterConfig) throws ServletException {
@ -70,7 +78,9 @@ public class WechatFilter implements Filter {
boolean isRelease = antPathMatcher.match(WECHAT_LOGIN_URL, requestUri)
|| antPathMatcher.match(WECHAT_RELEASE_URL, requestUri)
|| antPathMatcher.match(WECHAT_API_RELEASE_URL, requestUri)
|| antPathMatcher.match(WECHAT_ROUTE_RELEASE_URL, requestUri);
|| antPathMatcher.match(WECHAT_ROUTE_RELEASE_URL, requestUri)
|| antPathMatcher.match(WECHAT_ROUTE_STATIC_URL, requestUri)
|| antPathMatcher.match(WECHAT_ROUTE_HYBRID_URL, requestUri);
if (isRelease) {
filterChain.doFilter(request, response);
return;

View File

@ -124,9 +124,10 @@ public class WechatOfficialAccountManager {
WechatOfficialAccountAccessTokenForUser wechatOfficialAccountAccessTokenForUser = getUserAccessToken(code);
WechatOfficialAccountUserInfo wechatOfficialAccountUserInfo = getUserInfo(wechatOfficialAccountAccessTokenForUser.getAccess_token(), wechatOfficialAccountAccessTokenForUser.getOpenid());
WechatOfficialAccountUser wechatOfficialAccountUser = new WechatOfficialAccountUser();
// 绑定用户 | 登录
LOG.debug("绑定用户 | 登录");
String wechatSignInfo = Base64.encodeBase64String(AesUtil.aesCommonEncoder("WECHAT_SIGN_INFO", new StringBuilder(wechatOfficialAccountAccessTokenForUser.getOpenid()).append("_WenG_").append(wechatOfficialAccountProperties.getAppId()).toString()).getBytes("UTF-8"));
String token = getAppToken(wechatSignInfo);
LOG.debug("用户token{}", token);
wechatOfficialAccountUser.setToken(token);
wechatOfficialAccountUser.setWechatOfficialAccountAccessTokenForUser(wechatOfficialAccountAccessTokenForUser);
wechatOfficialAccountUser.setWechatOfficialAccountUserInfo(wechatOfficialAccountUserInfo);