zhouhao пре 7 година
родитељ
комит
a4a31d3546

+ 1 - 1
hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/WebSocketUtils.java

@@ -38,7 +38,7 @@ public class WebSocketUtils {
 
         Function<Set<String>, Optional<Authentication>> userGetter = set ->
                 set == null ? Optional.empty() : set.stream()
-                        .map(container::getAuthenticationBySessionId)
+                        .map(container::getByToken)
                         .filter(Objects::nonNull).findFirst();
 
         return userGetter.apply(sessionId.get("SESSION"))

+ 7 - 5
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-controller/src/main/java/org/hswebframework/web/controller/authorization/AuthorizationController.java

@@ -23,7 +23,8 @@ import io.swagger.annotations.ApiParam;
 import org.hswebframework.web.BusinessException;
 import org.hswebframework.web.NotFoundException;
 import org.hswebframework.web.authorization.Authentication;
-import org.hswebframework.web.authorization.AuthenticationInitializeService;
+//import org.hswebframework.web.authorization.AuthenticationInitializeService;
+import org.hswebframework.web.authorization.AuthenticationManager;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.listener.AuthorizationListenerDispatcher;
 import org.hswebframework.web.authorization.listener.event.*;
@@ -56,10 +57,11 @@ public class AuthorizationController {
     @Autowired
     private UserService userService;
 
-    @Autowired
-    private AuthenticationInitializeService authenticationInitializeService;
-
+//    @Autowired
+//    private AuthenticationInitializeService authenticationInitializeService;
 
+    @Autowired
+    private AuthenticationManager authenticationManager;
     @Autowired
     private AuthorizationListenerDispatcher authorizationListenerDispatcher;
 
@@ -109,7 +111,7 @@ public class AuthorizationController {
                 throw new BusinessException("{password_error}", 400);
             }
             // 验证通过
-            Authentication authentication = authenticationInitializeService.initUserAuthorization(entity.getId());
+            Authentication authentication = authenticationManager.getByUserId(entity.getId());
             AuthorizationSuccessEvent event = new AuthorizationSuccessEvent(authentication, parameterGetter);
             int size = authorizationListenerDispatcher.doEvent(event);
             if (size == 0) {