LoadedPemSslStore Class — spring-boot Architecture
Architecture documentation for the LoadedPemSslStore class in LoadedPemSslStore.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/LoadedPemSslStore.java lines 39–123
final class LoadedPemSslStore implements PemSslStore {
private final PemSslStoreDetails details;
private final ResourceLoader resourceLoader;
private final Supplier<CertificatesHolder> certificatesSupplier;
private final Supplier<PrivateKeyHolder> privateKeySupplier;
LoadedPemSslStore(PemSslStoreDetails details, ResourceLoader resourceLoader) {
Assert.notNull(details, "'details' must not be null");
Assert.notNull(resourceLoader, "'resourceLoader' must not be null");
this.details = details;
this.resourceLoader = resourceLoader;
this.certificatesSupplier = supplier(() -> loadCertificates(details, resourceLoader));
this.privateKeySupplier = supplier(() -> loadPrivateKey(details, resourceLoader));
}
private static <T> Supplier<T> supplier(ThrowingSupplier<T> supplier) {
return SingletonSupplier.of(supplier.throwing(LoadedPemSslStore::asUncheckedIOException));
}
private static UncheckedIOException asUncheckedIOException(String message, Exception cause) {
return new UncheckedIOException(message, (IOException) cause);
}
private static CertificatesHolder loadCertificates(PemSslStoreDetails details, ResourceLoader resourceLoader)
throws IOException {
PemContent pemContent = PemContent.load(details.certificates(), resourceLoader);
if (pemContent == null) {
return new CertificatesHolder(null);
}
return new CertificatesHolder(pemContent.getCertificates());
}
private static PrivateKeyHolder loadPrivateKey(PemSslStoreDetails details, ResourceLoader resourceLoader)
throws IOException {
PemContent pemContent = PemContent.load(details.privateKey(), resourceLoader);
return new PrivateKeyHolder(
(pemContent != null) ? pemContent.getPrivateKey(details.privateKeyPassword()) : null);
}
@Override
public @Nullable String type() {
return this.details.type();
}
@Override
public @Nullable String alias() {
return this.details.alias();
}
@Override
public @Nullable String password() {
return this.details.password();
}
@Override
public @Nullable List<X509Certificate> certificates() {
return this.certificatesSupplier.get().certificates();
}
@Override
public @Nullable PrivateKey privateKey() {
return this.privateKeySupplier.get().privateKey();
}
@Override
public PemSslStore withAlias(@Nullable String alias) {
return new LoadedPemSslStore(this.details.withAlias(alias), this.resourceLoader);
}
@Override
public PemSslStore withPassword(@Nullable String password) {
return new LoadedPemSslStore(this.details.withPassword(password), this.resourceLoader);
}
private record PrivateKeyHolder(@Nullable PrivateKey privateKey) {
}
private record CertificatesHolder(@Nullable List<X509Certificate> certificates) {
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free