ClientAppSecretData.Builder sb = ClientAppSecretData.newBuilder();
sb.setAppPassword(appPassword);
secrets = sb.build();
}
ClientAppData existing = getStore(project.getId()).find(appName);
if (existing != null) {
throw new WebApplicationException(Status.CONFLICT);
}
ClientAppData.Builder b = ClientAppData.newBuilder();
b.setProject(project.getId());
b.setKey(appName);
SecretToken secretToken = SecretToken.create(SecretTokenType.CLIENT_APP_SECRET);
buildSecretStore(b, secretToken, appPassword, authenticatedProject);
b.setSecretData(Secrets.buildClientAppSecret(secretToken, secrets));
try {
ClientAppData app = getStore(project.getId()).create(b);
return new ClientAppImpl(app, secrets);
} catch (DuplicateValueException e) {
throw new WebApplicationException(Status.CONFLICT);
}
}