我使用 Spring Boot、Spring Security、Spring websockets、stomp 和 sockjs 开发了一个移动聊天应用程序。服务器运行在 8082 端口,客户端运行在 8100 端口。
我正在使用 Angular 和 sockjs 客户端发送请求。当我尝试连接到 STOMP 端点时,它在开发人员控制台(前端)和后端控制台处给出错误。下面是轨迹,
Opening Web Socket...
stomp.min.js (line 8)
GET http://localhost:8082/ws/info?t=1451547968350
200 OK
565ms
sockjs-1.0.1.js (line 1610)
Web Socket Opened...
stomp.min.js (line 8)
CONNECT
login:test
passcode:test
accept-version:1.1,1.0
heart-beat:10000,10000
**<<< ERROR message:Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is org.springframework.security.access.AccessDeniedException\c Access is denied
content-length:0*
Run Code Online (Sandbox Code Playgroud)
2015-12-31 13:16:09.080 DEBUG 8116 --- [0.0-8082-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/ws/info'; against '/css/'
2015-12-31 13:16:09.081 …Run Code Online (Sandbox Code Playgroud)