pokearu commented on a change in pull request #6:
URL: https://github.com/apache/airavata-mft/pull/6#discussion_r413149321
##########
File path:
services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/file/FileBasedSecretBackend.java
##########
@@ -211,4 +213,57 @@ public boolean updateAzureSecret(AzureSecretUpdateRequest
request) throws Except
public boolean deleteAzureSecret(AzureSecretDeleteRequest request) throws
Exception {
throw new UnsupportedOperationException("Operation is not supported in
backend");
}
+
+ @Override
+ public Optional<GCSSecret> getGCSSecret(GCSSecretGetRequest request)
throws Exception {
+ JSONParser jsonParser = new JSONParser();
+ InputStream inputStream =
FileBasedSecretBackend.class.getClassLoader().getResourceAsStream(secretFile);
+
+ try (InputStreamReader reader = new InputStreamReader(inputStream)) {
+ Object obj = jsonParser.parse(reader);
+ JSONArray resourceList = (JSONArray) obj;
+
+ List<GCSSecret> gcsSecrets = (List<GCSSecret>)
resourceList.stream()
+ .filter(resource -> "GCS".equals(((JSONObject)
resource).get("type").toString()))
+ .map(resource -> {
+ JSONObject r = (JSONObject) resource;
+ StringBuilder contentBuilder = new StringBuilder();
+ BufferedReader br = null;
+ String jsonContents = "";
+ try {
+ br = new BufferedReader(new
FileReader(r.get("jsonCredentialsFilePath").toString()));
Review comment:
But with this approach a very large json has to be here as a string.
Would that be fine?
The problem is GCS requires this entire file and it's contents, unlike other
providers that can work with a single key.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]