[#2132] Migrate SSL support away from ThreadLocal, support key alias and default to pkcs12 - #2133
[#2132] Migrate SSL support away from ThreadLocal, support key alias and default to pkcs12#2133mattrpav wants to merge 2 commits into
Conversation
83e22b7 to
b458792
Compare
02cb65e to
20a8b36
Compare
|
This is a pretty major refactor and needs to be reviewed carefully before merging. I assume this will not be backported and only be targeted for 6.3.0 due to the major changes. @mattrpav - are there breaking API changes here? a quick look showed old methods delegating to the new ones so I don't think so but we don't want to break anyone who upgrades |
|
@cshannon correct, this is only for 6.3.0. The original SslContext is renamed ThreadLocalSslContext and remains if anyone needs previous behavior exactly. The ComaptibleSslContext provides same method signature as the ThreadLocalSslContexr for historical compatibility for wiring of arrays v lists, but removes the ThreadLocal usage. The DefaultThreadLocalContext becomes the new default. This change removes all ThreadLocalSslContext usage and updates transportConnectors and networkConnectors to support having independent SSLContexts as needed. They all fall back to the broker-wide one as before, if an independent sslcontext is not configured. |
20a8b36 to
8883f00
Compare
|
I did a quick browse of this and it makes sense to get rid of the thread local if possible but I need to do a deeper dive and try it out. I think there might be a couple things to tweak but overall I think this makes sense. The less thread locals we have the better and as you pointed out it gives us more flexibility in the future. |
ed2d96a to
685c96d
Compare
ac7e768 to
2898d07
Compare
2898d07 to
c427ffd
Compare
c427ffd to
1563c9b
Compare
cshannon
left a comment
There was a problem hiding this comment.
I went through a lot of it but I stopped after I saw there were still several spots where logic could be consolidated and get rid of copy and paste, so that is my main feedback, to reactor to consolidate the logic around connection into one spot, unless there's something that makes it not possible
0c82f19 to
9844c3a
Compare
cshannon
left a comment
There was a problem hiding this comment.
LGTM now, assuming CI runs and passes. It's a big update so I expect we may have missed something minor but if we find a tweak to make later we can push a follow on PR.
There was a problem hiding this comment.
@mattrpav - CI found a real failure, the DiscoveryTransportBrokerTest failed
It took me a while to track it down as it was tricky but it turns out during the recent refactor an override got missed, causing the DiscoveryTransportFactory to create an instance of FailoverTransport instead of DiscoveryTransport (that then contained the FailoverTransport).
The fix is pretty simple, I created a quick PR: mattrpav#8
…etwork sslcontext - DefaultSslContext (remove active usage of ThreadContextSslContext) - Add per-connector sslContect - Add per-networkConnector sslContext - Add ComptibleSslContext to bridge Spring for a non-ThreadLocalSslContext - Update FailoverTransport for SslContext handling - Update DiscoveryNetworkConnector for SslContext handling - Replace ternatry with Optional.orElse semantic - Add 'volatile' keyword to SslContext field on CompatibleSslContext for thread safety - Tighten up exception signatures, move away from throws Exception
This fixes the missing override that caused DiscoveryTransportBrokerTest to fail because it was not creating the right transport
210a9ad to
c92d723
Compare
All wiring of transports now takes SslContext as a parameter, instead of 'magically' showing up as a ThreadLocal when needed.
This unlocks a lot of capabilities, including per-transportConnector SSLContext, per-networkConnector SSLContext and eventually auto-reloading of SSLContext.
Merge plan: Squash all commits to one for v6.4.0 only (no backport)