public static SecurityExtension getSecurityExtension(ExtensionContext context) {
    ImmutableList.Builder<SecurityExtension> builder = ImmutableList.builder();
    ServiceLoader.load(SecurityExtension.class)
        .iterator()
        .forEachRemaining(builder::add);
    ImmutableList<SecurityExtension> extensions = builder.build();
    Preconditions.checkState(
        extensions.size() == 1,
        "Exactly one SecurityExtension is required, but found " + extensions.size());
    extensions.forEach(e -> e.initialize(context));
    return extensions.get(0);
  }
Helper for loading the security extensions in a runtime.
portability-spi-transfer/src/main/java/org/datatransferproject/spi/transfer/security/SecurityExtensionLoader.java