zouxuan 5 سال پیش
والد
کامیت
2cbcebf16f

+ 60 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/BasicUser.java

@@ -0,0 +1,60 @@
+package com.ym.mec.auth.api.entity;
+
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import org.springframework.security.oauth2.common.OAuth2RefreshToken;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+public class BasicUser implements OAuth2AccessToken {
+    private String password;
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Override
+    public Map<String, Object> getAdditionalInformation() {
+        return null;
+    }
+
+    @Override
+    public Set<String> getScope() {
+        return null;
+    }
+
+    @Override
+    public OAuth2RefreshToken getRefreshToken() {
+        return null;
+    }
+
+    @Override
+    public String getTokenType() {
+        return null;
+    }
+
+    @Override
+    public boolean isExpired() {
+        return false;
+    }
+
+    @Override
+    public Date getExpiration() {
+        return null;
+    }
+
+    @Override
+    public int getExpiresIn() {
+        return 0;
+    }
+
+    @Override
+    public String getValue() {
+        return null;
+    }
+}

+ 3 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/handler/BaseAuthenticationSuccessEventHandler.java

@@ -8,6 +8,7 @@ import java.util.HashMap;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.ym.mec.auth.api.entity.BasicUser;
 import org.apache.commons.collections.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -106,8 +107,9 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
 			OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);
 
 			OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);
-			OAuth2AccessToken oAuth2AccessToken = defaultAuthorizationServerTokenServices.createAccessToken(oAuth2Authentication);
+			BasicUser oAuth2AccessToken = (BasicUser)defaultAuthorizationServerTokenServices.createAccessToken(oAuth2Authentication);
 			logger.info("获取token 成功:{}", oAuth2AccessToken.getValue());
+			oAuth2AccessToken.setPassword(sysUser.getPassword());
 
 			response.setContentType("application/json; charset=utf-8");
 

+ 5 - 1
mec-client-api/src/main/java/com/ym/im/ImFeignService.java

@@ -3,8 +3,12 @@ package com.ym.im;
 import com.ym.im.fallback.ImFeignServiceFallback;
 import com.ym.mec.common.config.FeignConfiguration;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 
-@FeignClient(name = "auth-server", configuration = FeignConfiguration.class, fallback = ImFeignServiceFallback.class)
+@FeignClient(name = "im-server", configuration = FeignConfiguration.class, fallback = ImFeignServiceFallback.class)
 public interface ImFeignService {
 
+    @PostMapping(value = "user/register")
+    Object getUser(@RequestBody String username);
 }

+ 53 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/entity/ImUserModel.java

@@ -0,0 +1,53 @@
+package com.ym.mec.common.entity;
+
+public class ImUserModel {
+    public String id;
+
+    public String name;
+
+    public String portrait;
+
+    private Integer minute;
+
+    private ImUserModel[] blacklist;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPortrait() {
+        return portrait;
+    }
+
+    public void setPortrait(String portrait) {
+        this.portrait = portrait;
+    }
+
+    public Integer getMinute() {
+        return minute;
+    }
+
+    public void setMinute(Integer minute) {
+        this.minute = minute;
+    }
+
+    public ImUserModel[] getBlacklist() {
+        return blacklist;
+    }
+
+    public void setBlacklist(ImUserModel[] blacklist) {
+        this.blacklist = blacklist;
+    }
+}