| | |
| | | import org.springblade.modules.auth.provider.TokenParameter; |
| | | import org.springblade.modules.auth.utils.TokenUtil; |
| | | import org.springblade.modules.system.entity.UserInfo; |
| | | import org.springblade.modules.zc.service.IZcService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | private final BladeRedis bladeRedis; |
| | | private final JwtProperties jwtProperties; |
| | | private final IZcService iZcService; |
| | | |
| | | @ApiLog("登录用户验证") |
| | | @PostMapping("/oauth/token") |
| | |
| | | @ApiParam(value = "密码", required = true) @RequestParam(required = false) String password) { |
| | | |
| | | Kv authInfo = Kv.create(); |
| | | String s = iZcService.selectType(username); |
| | | |
| | | String grantType = WebUtil.getRequest().getParameter("grant_type"); |
| | | String refreshToken = WebUtil.getRequest().getParameter("refresh_token"); |
| | |
| | | ITokenGranter granter = TokenGranterBuilder.getGranter(grantType); |
| | | UserInfo userInfo = granter.grant(tokenParameter); |
| | | |
| | | if (userInfo == null || userInfo.getUser() == null) { |
| | | if (userInfo == null || userInfo.getUser() == null && s.equals("0")) { |
| | | return authInfo.set("error_description", "用户未审核"); |
| | | } |
| | | if (userInfo == null || userInfo.getUser() == null && s.equals("2")) { |
| | | return authInfo.set("error_description", "审核不通过"); |
| | | } |
| | | if (userInfo == null || userInfo.getUser() == null ) { |
| | | return authInfo.set("error_code", HttpServletResponse.SC_BAD_REQUEST).set("error_description", "用户名或密码不正确"); |
| | | } |
| | | |