i have application connected to websocket server
i am using spring websocket which secured by spring security
e.g "http://192.168.3.88:8080/api/websocket"
api/** is secured by spring security
so how to pas credentials from login to SockJS? because sockJs read this as an Authorized url
socket.client = new SockJS("http://192.168.3.88:8080/api/websocket")
socket.stomp = Stomp.over(socket.client) // this is unauthorized
socket.stomp.connect {}, startListener
here my spring cors config :
String origin = request.getHeader(ORIGIN);
response.setHeader("Access-Control-Allow-Origin", origin); response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "origin, content-type, accept, authorization, x-requested-with"); response.setHeader("Access-Control-Allow-Credentials", "true"); if (request.getMethod().equals("OPTIONS")) { try { response.getWriter().print("OK"); response.getWriter().flush(); } catch (IOException e) { e.printStackTrace(); } } else { chain.doFilter(req, res); }