Class AwsSigV4ClientHandshaker


  • public class AwsSigV4ClientHandshaker
    extends io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13
    Extends the functionality of WebSocketClientHandshaker13 by adding SIGV4 authentication headers to the request.
    • Field Summary

      • Fields inherited from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13

        MAGIC_GUID
      • Fields inherited from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker

        customHeaders, DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS
    • Constructor Summary

      Constructors 
      Constructor Description
      AwsSigV4ClientHandshaker​(URI webSocketURL, io.netty.handler.codec.http.websocketx.WebSocketVersion version, String subprotocol, boolean allowExtensions, io.netty.handler.codec.http.HttpHeaders customHeaders, int maxFramePayloadLength, ChainedSigV4PropertiesProvider sigV4PropertiesProvider)
      Deprecated.
      AwsSigV4ClientHandshaker​(URI webSocketURL, io.netty.handler.codec.http.websocketx.WebSocketVersion version, String subprotocol, boolean allowExtensions, io.netty.handler.codec.http.HttpHeaders customHeaders, int maxFramePayloadLength, ChainedSigV4PropertiesProvider sigV4PropertiesProvider, com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected io.netty.handler.codec.http.FullHttpRequest newHandshakeRequest()
      Gets the request as generated by WebSocketClientHandshaker13 and adds additional headers and a SIGV4 signature required for SigV4Auth.
      • Methods inherited from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13

        newWebsocketDecoder, newWebSocketEncoder, setForceCloseTimeoutMillis, verify
      • Methods inherited from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker

        actualSubprotocol, close, close, expectedSubprotocol, finishHandshake, forceCloseTimeoutMillis, handshake, handshake, isForceCloseComplete, isHandshakeComplete, maxFramePayloadLength, processHandshake, processHandshake, upgradeUrl, uri, version
    • Constructor Detail

      • AwsSigV4ClientHandshaker

        @Deprecated
        public AwsSigV4ClientHandshaker​(URI webSocketURL,
                                        io.netty.handler.codec.http.websocketx.WebSocketVersion version,
                                        String subprotocol,
                                        boolean allowExtensions,
                                        io.netty.handler.codec.http.HttpHeaders customHeaders,
                                        int maxFramePayloadLength,
                                        ChainedSigV4PropertiesProvider sigV4PropertiesProvider)
        Deprecated.
        Creates a new instance with default credentials provider (for backward compatibility).
        Parameters:
        webSocketURL - - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
        version - - Version of web socket specification to use to connect to the server
        subprotocol - - Sub protocol request sent to the server.
        allowExtensions - - Allow extensions to be used in the reserved bits of the web socket frame
        customHeaders - - Map of custom headers to add to the client request
        maxFramePayloadLength - - Maximum length of a frame's payload
        sigV4PropertiesProvider - - a properties provider to get sigV4 auth related properties
      • AwsSigV4ClientHandshaker

        public AwsSigV4ClientHandshaker​(URI webSocketURL,
                                        io.netty.handler.codec.http.websocketx.WebSocketVersion version,
                                        String subprotocol,
                                        boolean allowExtensions,
                                        io.netty.handler.codec.http.HttpHeaders customHeaders,
                                        int maxFramePayloadLength,
                                        ChainedSigV4PropertiesProvider sigV4PropertiesProvider,
                                        com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider)
        Creates a new instance.
        Parameters:
        webSocketURL - - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
        version - - Version of web socket specification to use to connect to the server
        subprotocol - - Sub protocol request sent to the server.
        allowExtensions - - Allow extensions to be used in the reserved bits of the web socket frame
        customHeaders - - Map of custom headers to add to the client request
        maxFramePayloadLength - - Maximum length of a frame's payload
        sigV4PropertiesProvider - - a properties provider to get sigV4 auth related properties
        awsCredentialsProvider - - an AWS credentials provider to use to generate signature
    • Method Detail

      • newHandshakeRequest

        protected io.netty.handler.codec.http.FullHttpRequest newHandshakeRequest()
        Gets the request as generated by WebSocketClientHandshaker13 and adds additional headers and a SIGV4 signature required for SigV4Auth. Sends the opening request to the server: GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 x-amz-date: 20180214T002049Z Authorization: [SIGV4AuthHeader]
        Overrides:
        newHandshakeRequest in class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13
        Returns:
        SIGV4 signed FullHttpRequest.