Class ControlPlaneWebSocketUpgradeGate

java.lang.Object
org.mockserver.netty.websocketregistry.ControlPlaneWebSocketUpgradeGate

public final class ControlPlaneWebSocketUpgradeGate extends Object
The checks every control-plane WebSocket upgrade (/_mockserver_ui_websocket and /_mockserver_callback_websocket) must pass before it is upgraded: the browser Origin must be allowed by CORSOriginPolicy, and the control-plane authentication, when configured, must allow the request. A rejected upgrade gets a 403 (origin or role) or 401 (credentials) and the connection is closed.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    The caller of an admitted upgrade: whether control-plane authentication admitted it and, when its authentication handler can name one, the caller's identity.
  • Method Summary

    Modifier and Type
    Method
    Description
    admitUpgrade(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest httpRequest, org.mockserver.mock.HttpState httpState, org.mockserver.logging.MockServerLogger mockServerLogger, boolean sslEnabledUpstream, String description)
     
    static boolean
    allowUpgrade(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest httpRequest, org.mockserver.mock.HttpState httpState, org.mockserver.logging.MockServerLogger mockServerLogger, boolean sslEnabledUpstream, String description)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • allowUpgrade

      public static boolean allowUpgrade(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest httpRequest, org.mockserver.mock.HttpState httpState, org.mockserver.logging.MockServerLogger mockServerLogger, boolean sslEnabledUpstream, String description)
      Parameters:
      description - names the socket in the rejection log, e.g. "dashboard UI"
      Returns:
      true when the upgrade may proceed; false once the rejection has been written
    • admitUpgrade

      public static ControlPlaneWebSocketUpgradeGate.Admission admitUpgrade(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest httpRequest, org.mockserver.mock.HttpState httpState, org.mockserver.logging.MockServerLogger mockServerLogger, boolean sslEnabledUpstream, String description)
      Parameters:
      description - names the socket in the rejection log, e.g. "dashboard UI"
      Returns:
      the admitted caller when the upgrade may proceed; null once the rejection has been written