forked from kidgrow-microservices-platform

zhaoxiaohao
2020-11-24 2c4189febf04adb1505ad3ed9816d9258fd852b8
kidgrow-uaa/kidgrow-uaa-server/src/main/java/com/kidgrow/oauth2/controller/OAuth2Controller.java
@@ -6,6 +6,7 @@
import com.kidgrow.authclient.util.AuthUtils;
import com.kidgrow.common.constant.SecurityConstants;
import com.kidgrow.common.context.ClientContextHolder;
import com.kidgrow.common.utils.AesUtils;
import com.kidgrow.common.utils.ResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -62,8 +63,12 @@
    public void getUserTokenInfo(
            @ApiParam(required = true, name = "username", value = "账号") String username,
            @ApiParam(required = true, name = "password", value = "密码") String password,
            HttpServletRequest request, HttpServletResponse response) throws IOException {
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
            HttpServletRequest request, HttpServletResponse response) throws Exception {
        //先解密
        String decryptName = AesUtils.desEncrypt(username).trim();
        String decryptPwd = AesUtils.desEncrypt(password).trim();
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(decryptName, decryptPwd);
        writerToken(request, response, token, "用户名或密码错误");
    }
@@ -115,6 +120,7 @@
            oAuth2Authentication.setAuthenticated(true);
            ResponseUtil.responseSucceed(objectMapper, response, oAuth2AccessToken);
        } catch (BadCredentialsException | InternalAuthenticationServiceException e) {
            e.printStackTrace();
            exceptionHandler(response, badCredenbtialsMsg);
        } catch (Exception e) {
            exceptionHandler(response, e);