|
@@ -18,10 +18,7 @@
|
|
|
package com.pig4cloud.pigx.auth.handler;
|
|
|
|
|
|
import com.pig4cloud.pigx.common.security.handler.AbstractAuthenticationSuccessEventHandler;
|
|
|
-import com.pig4cloud.pigx.common.security.service.PigxUser;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.messaging.simp.SimpMessagingTemplate;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -31,9 +28,7 @@ import org.springframework.stereotype.Component;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
-@AllArgsConstructor
|
|
|
public class PigxAuthenticationSuccessEventHandler extends AbstractAuthenticationSuccessEventHandler {
|
|
|
- private final SimpMessagingTemplate simpMessagingTemplate;
|
|
|
|
|
|
/**
|
|
|
* 处理登录成功方法
|
|
@@ -44,11 +39,6 @@ public class PigxAuthenticationSuccessEventHandler extends AbstractAuthenticatio
|
|
|
*/
|
|
|
@Override
|
|
|
public void handle(Authentication authentication) {
|
|
|
- Object principal = authentication.getPrincipal();
|
|
|
- log.info("用户:{} 登录成功", principal);
|
|
|
- PigxUser pigxUser = (PigxUser) principal;
|
|
|
-
|
|
|
- String user = String.format("%s-%s", pigxUser.getUsername(), pigxUser.getTenantId());
|
|
|
- simpMessagingTemplate.convertAndSendToUser(user, "/loginRemind", pigxUser.getUsername());
|
|
|
+ log.info("用户:{} 登录成功", authentication.getPrincipal());
|
|
|
}
|
|
|
}
|