Skip to content

Commit

Permalink
Add utility method for obtaining TlsConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jun 7, 2024
1 parent 9222682 commit 60e1fe1
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
*/
public interface TlsConfiguration {

static Optional<TlsConfiguration> from(TlsConfigurationRegistry registry, Optional<String> name) {
if (name.isPresent()) {
Optional<TlsConfiguration> maybeConfiguration = registry.get(name.get());
if (maybeConfiguration.isEmpty()) {
throw new IllegalStateException("Unable to find the TLS configuration for name " + name + ".");
}
return maybeConfiguration;
}
return registry.getDefault();
}

/**
* Returns the key store.
*
Expand Down

0 comments on commit 60e1fe1

Please sign in to comment.