/** * A method that can be used to associate a user with the WebSocket session * in the process of being established. The default implementation calls * {@link ServerHttpRequest#getPrincipal()} * <p>Subclasses can provide custom logic for associating a user with a session, * for example for assigning a name to anonymous users (i.e. not fully authenticated). * @param request the handshake request * @param wsHandler the WebSocket handler that will handle messages * @param attributes handshake attributes to pass to the WebSocket session * @return the user for the WebSocket session, or {@code null} if not available */ @Nullable protected Principal determineUser( ServerHttpRequest request, WebSocketHandler wsHandler, Map<String, Object> attributes) { return request.getPrincipal(); }
if (principal != null && !principal.equals(request.getPrincipal())) { logger.debug("The user for the session does not match the user for the request."); response.setStatusCode(HttpStatus.NOT_FOUND);
this.principal = request.getPrincipal(); try { this.localAddress = request.getLocalAddress();
/** * A method that can be used to associate a user with the WebSocket session * in the process of being established. The default implementation calls * {@link ServerHttpRequest#getPrincipal()} * <p>Subclasses can provide custom logic for associating a user with a session, * for example for assigning a name to anonymous users (i.e. not fully authenticated). * @param request the handshake request * @param wsHandler the WebSocket handler that will handle messages * @param attributes handshake attributes to pass to the WebSocket session * @return the user for the WebSocket session, or {@code null} if not available */ @Nullable protected Principal determineUser( ServerHttpRequest request, WebSocketHandler wsHandler, Map<String, Object> attributes) { return request.getPrincipal(); }
/** * A method that can be used to associate a user with the WebSocket session * in the process of being established. The default implementation calls * {@link ServerHttpRequest#getPrincipal()} * <p>Subclasses can provide custom logic for associating a user with a session, * for example for assigning a name to anonymous users (i.e. not fully authenticated). * @param request the handshake request * @param wsHandler the WebSocket handler that will handle messages * @param attributes handshake attributes to pass to the WebSocket session * @return the user for the WebSocket session, or {@code null} if not available */ @Nullable protected Principal determineUser( ServerHttpRequest request, WebSocketHandler wsHandler, Map<String, Object> attributes) { return request.getPrincipal(); }
if (principal != null && !principal.equals(request.getPrincipal())) { logger.debug("The user for the session does not match the user for the request."); response.setStatusCode(HttpStatus.NOT_FOUND);
if (principal != null && !principal.equals(request.getPrincipal())) { logger.debug("The user for the session does not match the user for the request."); response.setStatusCode(HttpStatus.NOT_FOUND);
this.principal = request.getPrincipal(); try { this.localAddress = request.getLocalAddress();
this.principal = request.getPrincipal(); try { this.localAddress = request.getLocalAddress();