-
Notifications
You must be signed in to change notification settings - Fork 935
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies - Blockhound 1.0.8.RELEASE -> 1.0.9.RELEASE - Control Plane 1.0.44 -> 1.0.45 - GraphQL Kotlin 7.0.2 -> 7.1.1 - gRPC Java 1.63.0 -> 1.64.0 - Guava 33.1.0-jre -> 33.2.0-jre - Jackson 2.17.0 -> 2.17.1 - Kotlin Coroutine 1.8.0 -> 1.8.1 - Kubernetes client 6.11.0 -> 6.12.1 - Mircometer 1.12.4 -> 1.13.0 - Netty 4.1.108.Final -> 4.1.110.Final - Reactor 3.6.4 -> 3.6.6 - Scala2.13 2.13.13 -> 2.13.14 - Scala Collection compat 2.11.0 -> 2.12.0 - Spring 6.1.5 -> 6.1.8 - Spring Boot 3.2.4 -> 3.3.0 - Build - Errorprone 2.26.1 -> 2.27.1 - Finagle 23.11.0 -> 24.2.0 - GraphQL DGS client 8.5.3 -> 8.6.1 - Jakarta Validation 3.0.2 -> 3.1.0 - Jakarta WebSocket 2.1.1 -> 2.2.0 - Jkube 1.15.0 -> 1.16.2 - Picocli 4.7.5 -> 4.7.6 - Test containers 1.19.7 -> 1.19.8 Close #5697
- Loading branch information
Showing
6 changed files
with
152 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...webflux-autoconfigure/src/main/java/com/linecorp/armeria/spring/web/reactive/TlsUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2024 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package com.linecorp.armeria.spring.web.reactive; | ||
|
||
import java.security.KeyStore; | ||
import java.util.function.Supplier; | ||
|
||
import org.springframework.boot.web.server.SslStoreProvider; | ||
|
||
import com.linecorp.armeria.common.util.Exceptions; | ||
import com.linecorp.armeria.internal.spring.ArmeriaConfigurationUtil; | ||
import com.linecorp.armeria.server.ServerBuilder; | ||
import com.linecorp.armeria.spring.Ssl; | ||
|
||
final class TlsUtil { | ||
|
||
static void configureTls(ServerBuilder sb, Ssl ssl, | ||
ArmeriaReactiveWebServerFactory factory) { | ||
final SslStoreProvider sslStoreProvider = factory.getSslStoreProvider(); | ||
final Supplier<KeyStore> keyStoreSupplier; | ||
final Supplier<KeyStore> trustStoreSupplier; | ||
if (sslStoreProvider != null) { | ||
keyStoreSupplier = () -> { | ||
try { | ||
return sslStoreProvider.getKeyStore(); | ||
} catch (Exception e) { | ||
return Exceptions.throwUnsafely(e); | ||
} | ||
}; | ||
trustStoreSupplier = () -> { | ||
try { | ||
return sslStoreProvider.getTrustStore(); | ||
} catch (Exception e) { | ||
return Exceptions.throwUnsafely(e); | ||
} | ||
}; | ||
} else { | ||
keyStoreSupplier = null; | ||
trustStoreSupplier = null; | ||
} | ||
ArmeriaConfigurationUtil.configureTls(sb, ssl, keyStoreSupplier, trustStoreSupplier); | ||
} | ||
|
||
private TlsUtil() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...webflux-autoconfigure/src/main/java/com/linecorp/armeria/spring/web/reactive/TlsUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2024 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package com.linecorp.armeria.spring.web.reactive; | ||
|
||
import java.security.KeyStore; | ||
import java.util.function.Supplier; | ||
|
||
import org.springframework.boot.ssl.SslBundle; | ||
import org.springframework.boot.web.server.WebServerSslBundle; | ||
|
||
import com.linecorp.armeria.common.util.Exceptions; | ||
import com.linecorp.armeria.internal.spring.ArmeriaConfigurationUtil; | ||
import com.linecorp.armeria.server.ServerBuilder; | ||
import com.linecorp.armeria.spring.Ssl; | ||
|
||
final class TlsUtil { | ||
|
||
static void configureTls(ServerBuilder sb, Ssl ssl, | ||
ArmeriaReactiveWebServerFactory factory) { | ||
if (!ssl.isEnabled()) { | ||
return; | ||
} | ||
final org.springframework.boot.web.server.Ssl springSsl = factory.getSsl(); | ||
final Supplier<KeyStore> keyStoreSupplier; | ||
final Supplier<KeyStore> trustStoreSupplier; | ||
if ((springSsl.getCertificate() != null && springSsl.getCertificatePrivateKey() != null) || // PEM | ||
ssl.getKeyStore() != null || "PKCS11".equals(ssl.getKeyStoreType())) { // JSK | ||
final SslBundle sslBundle = WebServerSslBundle.get(springSsl, factory.getSslBundles()); | ||
keyStoreSupplier = () -> { | ||
try { | ||
return sslBundle.getStores().getKeyStore(); | ||
} catch (Exception e) { | ||
return Exceptions.throwUnsafely(e); | ||
} | ||
}; | ||
trustStoreSupplier = () -> { | ||
try { | ||
return sslBundle.getStores().getTrustStore(); | ||
} catch (Exception e) { | ||
return Exceptions.throwUnsafely(e); | ||
} | ||
}; | ||
} else { | ||
keyStoreSupplier = null; | ||
trustStoreSupplier = null; | ||
} | ||
ArmeriaConfigurationUtil.configureTls(sb, ssl, keyStoreSupplier, trustStoreSupplier); | ||
} | ||
|
||
private TlsUtil() {} | ||
} |