|
@@ -1,9 +1,13 @@
|
|
|
package com.ym.mec.auth.web.controller;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.auth.core.service.AccessTokenService;
|
|
|
+import com.ym.mec.auth.service.SysUserService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.security.AuthUser;
|
|
|
+import com.ym.mec.common.security.SecurityUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.*;
|
|
@@ -37,6 +41,9 @@ public class TokenController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private AccessTokenService accessTokenService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserService userService;
|
|
|
|
|
|
@PostMapping("/smsLogin")
|
|
|
public Object smsLogin(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
|
|
@@ -49,6 +56,15 @@ public class TokenController extends BaseController {
|
|
|
|
|
|
return succeed(accessTokenService.getAccessToken(clientId, clientSecret, authentication));
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/queryUserInfo")
|
|
|
+ public SysUser queryUserInfo() {
|
|
|
+ AuthUser authUser = SecurityUtils.getUser();
|
|
|
+ if(authUser != null){
|
|
|
+ return userService.get(authUser.getUserId());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
@PostMapping("/usernameLogin")
|
|
|
public Object usernameLogin(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
|