refactor(login): 调整微信公众号 OAuth2 登录流程- 注释掉原有的授权 URL生成和重定向逻辑
- 新增测试用 TokenBean 对象,用于模拟登录成功后的处理 - 修改重定向 URL,增加测试参数
This commit is contained in:
@@ -170,8 +170,9 @@ public class LoginController {
|
|||||||
extra = "";
|
extra = "";
|
||||||
}
|
}
|
||||||
String configUrl = globalConfig.buildPath("/login/wxmp/oauth2/" + service + "?extra=" + extra);
|
String configUrl = globalConfig.buildPath("/login/wxmp/oauth2/" + service + "?extra=" + extra);
|
||||||
String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_base");
|
// String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_base");
|
||||||
response.sendRedirect(authorizationUrl);
|
// response.sendRedirect(authorizationUrl);
|
||||||
|
response.sendRedirect(configUrl+"&to=mobile&code=200");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -181,9 +182,13 @@ public class LoginController {
|
|||||||
@RequestMapping("/wxmp/oauth2/{service}")
|
@RequestMapping("/wxmp/oauth2/{service}")
|
||||||
@OperationIgnore
|
@OperationIgnore
|
||||||
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
// WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||||
TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(wxUserInfo.getAppId(),
|
// TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(wxUserInfo.getAppId(),
|
||||||
wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
|
// wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
|
||||||
|
TokenBean tokenBean = new TokenBean();
|
||||||
|
tokenBean.setId("testid");
|
||||||
|
tokenBean.setRoleId("testroleid");
|
||||||
|
tokenBean.setExtra("testextra");
|
||||||
corePlatformUniqueService.redirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
corePlatformUniqueService.redirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user