mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 13:19:01 +08:00
🔥 Removing code or files.
This commit is contained in:
1 parent
41b6051b99
commit
81f4d91b7b
4 files changed
+2
-45
No files matched your search
@@ -72,11 +72,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
<!--websocket-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<!--spring security 、oauth、jwt依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
||||
@@ -69,7 +69,7 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(
|
||||
"/token/**",
|
||||
"/actuator/**",
|
||||
"/mobile/**","/ws/**").permitAll()
|
||||
"/mobile/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and().csrf().disable()
|
||||
.apply(mobileSecurityConfigurer());
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.pig4cloud.pigx.auth.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
||||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
|
||||
|
||||
/**
|
||||
* @author new
|
||||
* <p>
|
||||
* WebSocket配置类
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSocketMessageBroker
|
||||
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||
@Override
|
||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
registry.addEndpoint("/ws")
|
||||
.setAllowedOrigins("*")
|
||||
.withSockJS();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureMessageBroker(MessageBrokerRegistry registry) {
|
||||
registry.setUserDestinationPrefix("/user/");
|
||||
}
|
||||
}
|
||||
+1
-11
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user