| | |
| | | protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) { |
| | | Map<String, String> parameters = new LinkedHashMap<String, String>(tokenRequest.getRequestParameters()); |
| | | String phone = parameters.get("username"); |
| | | String code = parameters.get("password"); |
| | | |
| | | //password和redis中的对比 |
| | | String redisCode = bladeRedis.get(CacheNames.WX_KEY + phone); |
| | | // 判断验证码 |
| | | if (code == null || !StringUtil.equalsIgnoreCase(redisCode, code)) { |
| | | throw new UserDeniedAuthorizationException("登录失败"); |
| | | } |
| | | |
| | | // 通过手机号查询用户 |
| | | Authentication userAuth = new UsernamePasswordAuthenticationToken(phone, "CUSTOM_LOGIN_WX"); |
| | | ((AbstractAuthenticationToken) userAuth).setDetails(parameters); |