use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class SseConditionConfigAdapterTest method initJson.
@Before
public void initJson() {
JsonbConfig config = new JsonbConfig().withAdapters(new SseConditionConfigAdapter());
jsonb = JsonbBuilder.create(config);
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class FileSystemOptionsConfigAdapterTest method initJson.
@Before
public void initJson() {
JsonbConfig config = new JsonbConfig().withAdapters(new FileSystemOptionsConfigAdapter());
jsonb = JsonbBuilder.create(config);
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class SseKafkaConditionConfigAdapterTest method initJson.
@Before
public void initJson() {
JsonbConfig config = new JsonbConfig().withAdapters(new SseKafkaConditionConfigAdapter());
jsonb = JsonbBuilder.create(config);
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class ZpmEncrypt method writeSecurity.
private void writeSecurity(ZpmSecurity security) throws IOException {
Path securityFile = settingsDir.resolve("security.json");
Jsonb builder = JsonbBuilder.newBuilder().withConfig(new JsonbConfig().withFormatting(true)).build();
createDirectories(settingsDir);
try (OutputStream out = newOutputStream(securityFile)) {
builder.toJson(security, out);
}
}
use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.
the class ZpmInstall method readSettings.
private void readSettings(Path settingsDir) throws IOException, PlexusCipherException {
Path settingsFile = settingsDir.resolve("settings.json");
ZpmSettings settings = new ZpmSettings();
settings.credentials = emptyList();
Jsonb builder = JsonbBuilder.newBuilder().withConfig(new JsonbConfig().withFormatting(true)).build();
if (Files.exists(settingsFile)) {
try (InputStream in = newInputStream(settingsFile)) {
settings = builder.fromJson(in, ZpmSettings.class);
}
}
if (settings.credentials.size() > 0) {
Path securityFile = settingsDir.resolve("security.json");
ZpmSecurity security = new ZpmSecurity();
if (Files.exists(securityFile)) {
try (InputStream in = newInputStream(securityFile)) {
security = builder.fromJson(in, ZpmSecurity.class);
}
}
security.secret = decryptSecret(security.secret, SYSTEM_PROPERTY_SEC_LOCATION);
for (ZpmCredentials credentials : settings.credentials) {
String realm = defaultRealmIfNecessary(credentials);
String host = credentials.host;
String username = credentials.username;
String password = ZpmSecrets.decryptSecret(credentials.password, security.secret);
CredentialsStore.INSTANCE.addCredentials(realm, host, username, password);
}
}
}
Aggregations