-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SslConfig APIs and fix SNI and SSL hostname bugs #1387
Conversation
servicetalk-http-api/src/main/java/io/servicetalk/http/api/MultiAddressHttpClientBuilder.java
Show resolved
Hide resolved
...ttp-api/src/main/java/io/servicetalk/http/api/PartitionedHttpClientSecurityConfigurator.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/DelegatingSslConfig.java
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/HttpServerConfig.java
Show resolved
Hide resolved
I like the new API. |
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/HttpServerConfig.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that the new approach solves our issues, like it!
...-transport-api/src/main/java/io/servicetalk/transport/api/DefaultClientSslConfigBuilder.java
Outdated
Show resolved
Hide resolved
...-transport-api/src/main/java/io/servicetalk/transport/api/DefaultClientSslConfigBuilder.java
Outdated
Show resolved
Hide resolved
...-transport-api/src/main/java/io/servicetalk/transport/api/DefaultClientSslConfigBuilder.java
Outdated
Show resolved
Hide resolved
...-transport-api/src/main/java/io/servicetalk/transport/api/DefaultServerSslConfigBuilder.java
Outdated
Show resolved
Hide resolved
...-transport-api/src/main/java/io/servicetalk/transport/api/DefaultClientSslConfigBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/MultiAddressHttpClientBuilder.java
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/MultiAddressHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/PartitionedHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/AlpnServerContext.java
Outdated
Show resolved
Hide resolved
...p-netty/src/main/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
build failure attributed to #1224 |
build failure attributed to #999 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after the last comments addressed:
servicetalk-http-api/src/main/java/io/servicetalk/http/api/MultiAddressHttpClientBuilder.java
Show resolved
Hide resolved
...p-netty/src/main/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilder.java
Show resolved
Hide resolved
...p-netty/src/main/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
...p-netty/src/main/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilder.java
Show resolved
Hide resolved
...ttp-netty/src/main/java/io/servicetalk/http/netty/DefaultSingleAddressHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/AbstractSslConfigBuilder.java
Show resolved
Hide resolved
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/AbstractSslConfigBuilder.java
Show resolved
Hide resolved
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/AbstractSslConfigBuilder.java
Outdated
Show resolved
Hide resolved
...icetalk-transport-api/src/main/java/io/servicetalk/transport/api/ClientSslConfigBuilder.java
Show resolved
Hide resolved
Motivation: The server SSL config APIs for SNI didn't allow configuring SSL associated with each individual SNI host. The client APIs coupled the host name verification algorithm with the non-authoritative peer host/port. This doesn't correctly represent the semantics of SSL. Modifications: - Deprecate all APIs related to SecurityConfigurator and secure() builder method. The secure() builder methods require that users call commit() which is easy to miss if the builder is used in a conditional block, and prototypes of a composable server SNI API results in code that is difficult to read and understand which configurations apply. - Add SslConfig interface types and builders that can be used to create the ssl configuration independent of the protocol builders. This allows for folks to configure ssl independently and we can overlay any values which maybe automatically inferred in the protocol builder (e.g. peerHost on the client, alpn protocols, etc.). - Server SSL allows for providing SNI configuration, and Netty's DomainWildcardMappingBuilder is used to match hostnames. - Client side SSL config object removes methods which couple the host name verification algorithm to the non-authoritative peer host/port, and adds new methods which allow setting them independently. - Update all tests to enable host name verification, and avoid deprecated method use when possible. Result: SSL config APIs now correctly represent SNI semantics for client and server. The client SSL config decouples the non-authoritative peer host/port from the verification algorithm. The deprecated types and methods will be removed in a future release.
…tBuildContext Motivation: `DefaultMultiAddressHttpClientBuilder` and `DefaultPartitionedHttpClientBuilder` use `DefaultSingleAddressHttpClientBuilder` as a template for underlying single-address clients. It was helpful before we introduced a `SingleAddressInitializer` in apple#1387. Before that, all builders had the same set of methods and it was nice to reuse the single-address builder instead of maintaining a similar state at higher level builders. Now, `SingleAddressInitializer` helps to avoid duplication between builders. We don't have to use `DefaultSingleAddressHttpClientBuilder` as a template and can simplify its state by using a factory for `SingleAddressHttpClientBuilder`. Modifications: - `DefaultMultiAddressUrlHttpClientBuilder` and `DefaultPartitionedHttpClientBuilder` use a factory for `SingleAddressHttpClientBuilder` instead of `DefaultSingleAddressHttpClientBuilder` as a template and `HttpExecutionContextBuilder` for context-related items; - Remove and hide methods from `DefaultSingleAddressHttpClientBuilder` that are not used by other builders anymore; - Add a test to verify `DefaultMultiAddressUrlHttpClientBuilder` sets execution context items for underlying single-address builders; Result: `DefaultSingleAddressHttpClientBuilder` has less pkg-private API, `DefaultMultiAddressUrlHttpClientBuilder` and `DefaultPartitionedHttpClientBuilder` create a new single-address builder on demand, similar to grpc builders.
…ntBuildContext` (#2136) Motivation: `DefaultMultiAddressHttpClientBuilder` and `DefaultPartitionedHttpClientBuilder` use `DefaultSingleAddressHttpClientBuilder` as a template for underlying single-address clients. It was helpful before we introduced a `SingleAddressInitializer` in #1387. Before that, all builders had the same set of methods and it was nice to reuse the single-address builder instead of maintaining a similar state at higher level builders. Now, `SingleAddressInitializer` helps to avoid duplication between builders. We don't have to use `DefaultSingleAddressHttpClientBuilder` as a template and can simplify its state by using a factory for `SingleAddressHttpClientBuilder`. Modifications: - `DefaultMultiAddressUrlHttpClientBuilder` and `DefaultPartitionedHttpClientBuilder` use a factory for `SingleAddressHttpClientBuilder` instead of `DefaultSingleAddressHttpClientBuilder` as a template and `HttpExecutionContextBuilder` for context-related items; - Remove and hide methods from `DefaultSingleAddressHttpClientBuilder` that are not used by other builders anymore; - Add a test to verify `DefaultMultiAddressUrlHttpClientBuilder` sets execution context items for underlying single-address builders; Result: `DefaultSingleAddressHttpClientBuilder` has less pkg-private API, `DefaultMultiAddressUrlHttpClientBuilder` and `DefaultPartitionedHttpClientBuilder` create a new single-address builder on demand, similar to grpc builders.
Motivation:
The server SSL config APIs for SNI didn't allow configuring SSL
associated with each individual SNI host. The client APIs coupled the
host name verification algorithm with the non-authoritative peer
host/port. This doesn't correctly represent the semantics of SSL.
Modifications:
builder method. The secure() builder methods require that users call
commit() which is easy to miss if the builder is used in a conditional
block, and prototypes of a composable server SNI API results in code
that is difficult to read and understand which configurations apply.
the ssl configuration independent of the protocol builders. This
allows for folks to configure ssl independently and we can overlay any
values which maybe automatically inferred in the protocol builder
(e.g. peerHost on the client, alpn protocols, etc.).
DomainWildcardMappingBuilder is used to match hostnames.
name verification algorithm to the non-authoritative peer host/port,
and adds new methods which allow setting them independently.
deprecated method use when possible.
Result:
SSL config APIs now correctly represent SNI semantics for client and
server. The client SSL config decouples the non-authoritative peer
host/port from the verification algorithm.
The deprecated types and methods will be removed in a future release.