aniruddhavpatil commented on a change in pull request #11:
URL: https://github.com/apache/airavata-mft/pull/11#discussion_r417054930



##########
File path: 
services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/file/FileBasedSecretBackend.java
##########
@@ -292,5 +292,45 @@ public boolean 
deleteDropboxSecret(DropboxSecretDeleteRequest request) throws Ex
         throw new UnsupportedOperationException("Operation is not supported in 
backend");
     }
 
+    @Override
+    public Optional<GDriveSecret> getGDriveSecret(GDriveSecretGetRequest 
request) throws Exception {
+        //throw new UnsupportedOperationException("Operation is not supported 
in backend");
+        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<GDriveSecret> gDriveSecrets = (List<GDriveSecret>) 
resourceList.stream()
+                    .filter(resource -> "GDRIVE".equals(((JSONObject) 
resource).get("type").toString()))
+                    .map(resource -> {
+                        JSONObject r = (JSONObject) resource;
+
+                        GDriveSecret gDriveSecret = GDriveSecret.newBuilder()
+                                .setSecretId(r.get("secretId").toString())
+                                
.setCredentialsJson(r.get("credentialsJson").toString()).build();

Review comment:
       That's right. Google provides a credential json.




----------------------------------------------------------------
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]


Reply via email to