Check the user of a SockJS request
Issue: SPR-12497
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package org.springframework.web.socket.sockjs.transport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.security.Principal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -245,6 +247,15 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (session.getPrincipal() != null) {
|
||||
if (!session.getPrincipal().equals(request.getPrincipal())) {
|
||||
logger.debug("The user for the session does not match the user for the request.");
|
||||
response.setStatusCode(HttpStatus.NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (transportType.sendsNoCacheInstruction()) {
|
||||
addNoCacheHeaders(response);
|
||||
|
||||
Reference in New Issue
Block a user