This is an automated email from the ASF dual-hosted git repository.

isjarana pushed a commit to branch baremetal
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git


The following commit(s) were added to refs/heads/baremetal by this push:
     new eed065b9c custos-serices
     new bb831e62c Merge pull request #356 from isururanawaka/baremetal
eed065b9c is described below

commit eed065b9ca409c8a375a31bb6dd03b99f4a491cd
Author: Isuru Ranawaka <[email protected]>
AuthorDate: Thu Feb 9 22:08:02 2023 -0500

    custos-serices
---
 .../org/apache/custos/scim/resource/GroupResource.java    | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/GroupResource.java
 
b/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/GroupResource.java
index 2c0c8682d..c6529f847 100644
--- 
a/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/GroupResource.java
+++ 
b/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/GroupResource.java
@@ -33,6 +33,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.wso2.charon3.core.protocol.SCIMResponse;
 import org.wso2.charon3.core.protocol.endpoints.GroupResourceManager;
+import org.wso2.charon3.core.protocol.endpoints.UserResourceManager;
 
 import java.util.Map;
 import java.util.Optional;
@@ -271,8 +272,20 @@ public class GroupResource extends AbstractResource {
     @PostMapping(value = ("/.search"), produces = {"application/json", 
"application/scim+json"}, consumes = {"application/scim+json"})
     public ResponseEntity getGroupsByPost(@RequestBody  String resourceString, 
@RequestHeader(value = Constants.AUTHORIZATION) String authorizationHeader) {
 
-        authHandler.validateAndConfigure(authorizationHeader, false);
+        Optional<AuthClaim> claim = 
authHandler.validateAndConfigure(authorizationHeader, false);
+
+
+        JSONObject newObj = new JSONObject();
+        JSONObject custosExtention = new JSONObject(resourceString);
+        if (claim.isPresent()) {
+            newObj.put(Constants.CLIENT_ID, claim.get().getIamAuthId());
+            newObj.put(Constants.CLIENT_SEC, claim.get().getIamAuthSecret());
+            newObj.put(Constants.TENANT_ID, 
String.valueOf(claim.get().getTenantId()));
+            newObj.put(Constants.ACCESS_TOKEN, 
authHandler.getToken(authorizationHeader));
+        }
 
+        custosExtention.put(Constants.DOMAIN, newObj.toString());
+        
         GroupResourceManager groupResourceManager = new GroupResourceManager();
 
         SCIMResponse response = 
groupResourceManager.listWithPOST(resourceString, resourceManager);

Reply via email to