You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2023/02/08 15:33:38 UTC

[airavata-custos] branch baremetal updated: add scim module to integration server

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 973fabf20 add scim module to integration server
     new 8e60cb07e Merge pull request #346 from isururanawaka/baremetal
973fabf20 is described below

commit 973fabf208e712514ba49aa1dd820ce173e25c92
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Wed Feb 8 10:32:58 2023 -0500

    add scim module to integration server
---
 .../custos-integration-services-server/pom.xml     |  6 ++
 .../src/main/dist/conf/application.properties      |  1 +
 .../dist/conf/custos_user_schema_extention.json    | 91 ++++++++++++++++++++++
 .../resources/custos_user_schema_extention.json    | 91 ++++++++++++++++++++++
 .../apache/custos/scim/SCIMServiceInitializer.java | 64 +++++++--------
 .../scim/resource/manager/ResourceManager.java     |  7 +-
 6 files changed, 225 insertions(+), 35 deletions(-)

diff --git a/custos-services/custos-integration-services-server/pom.xml b/custos-services/custos-integration-services-server/pom.xml
index 54f6620a0..f99518346 100644
--- a/custos-services/custos-integration-services-server/pom.xml
+++ b/custos-services/custos-integration-services-server/pom.xml
@@ -109,6 +109,12 @@
             <version>${project.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.custos</groupId>
+            <artifactId>scim-service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
diff --git a/custos-services/custos-integration-services-server/src/main/dist/conf/application.properties b/custos-services/custos-integration-services-server/src/main/dist/conf/application.properties
index 05e8fc2e6..e738eb225 100644
--- a/custos-services/custos-integration-services-server/src/main/dist/conf/application.properties
+++ b/custos-services/custos-integration-services-server/src/main/dist/conf/application.properties
@@ -35,3 +35,4 @@ core.services.server.port=7000
 core.services.server.hostname=localhost
 iam.server.url=https://keycloak.custos.scigap.org:31000/auth/
 tenant.base.uri=https://service.staging.usecustos.org/apiserver/tenant-management/v1.0.0/oauth2/tenant
+scim.user.schema.location=
diff --git a/custos-services/custos-integration-services-server/src/main/dist/conf/custos_user_schema_extention.json b/custos-services/custos-integration-services-server/src/main/dist/conf/custos_user_schema_extention.json
new file mode 100644
index 000000000..f26971b9b
--- /dev/null
+++ b/custos-services/custos-integration-services-server/src/main/dist/conf/custos_user_schema_extention.json
@@ -0,0 +1,91 @@
+[{
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.clientId",
+    "attributeName": "clientId",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "client Id",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.clientSec",
+    "attributeName": "clientSec",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "client sec",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.accessToken",
+    "attributeName": "accessToken",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "access token",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.tenantId",
+    "attributeName": "tenantId",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "access token",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension",
+    "attributeName": "custosExtension",
+    "dataType": "complex",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "Custos Extension",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "clientId clientSec accessToken tenantId",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  }
+]
\ No newline at end of file
diff --git a/custos-services/custos-integration-services-server/src/main/resources/custos_user_schema_extention.json b/custos-services/custos-integration-services-server/src/main/resources/custos_user_schema_extention.json
new file mode 100644
index 000000000..f26971b9b
--- /dev/null
+++ b/custos-services/custos-integration-services-server/src/main/resources/custos_user_schema_extention.json
@@ -0,0 +1,91 @@
+[{
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.clientId",
+    "attributeName": "clientId",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "client Id",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.clientSec",
+    "attributeName": "clientSec",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "client sec",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.accessToken",
+    "attributeName": "accessToken",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "access token",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension.tenantId",
+    "attributeName": "tenantId",
+    "dataType": "string",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "access token",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "null",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  },
+  {
+    "attributeURI": "urn:scim:schemas:extension:custos:1.0:custosExtension",
+    "attributeName": "custosExtension",
+    "dataType": "complex",
+    "multiValued": "false",
+    "multiValuedAttributeChildName": "null",
+    "description": "Custos Extension",
+    "schemaURI": "urn:scim:schemas:extension:custos:1.0",
+    "readOnly": "false",
+    "required": "false",
+    "caseExact": "false",
+    "subAttributes": "clientId clientSec accessToken tenantId",
+    "mutability": "readWrite",
+    "returned": "default",
+    "uniqueness": "none",
+    "canonicalValues": [],
+    "referenceTypes": []
+  }
+]
\ No newline at end of file
diff --git a/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/SCIMServiceInitializer.java b/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/SCIMServiceInitializer.java
index 745e94926..6e70814d8 100644
--- a/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/SCIMServiceInitializer.java
+++ b/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/SCIMServiceInitializer.java
@@ -1,32 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.custos.scim;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-
-@SpringBootApplication
-@ComponentScan(basePackages = "org.apache.custos")
-public class SCIMServiceInitializer {
-    public static void main(String[] args) {
-        SpringApplication.run(SCIMServiceInitializer.class, args);
-    }
-}
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// *  specific language governing permissions and limitations
+// *  under the License.
+// */
+//
+//package org.apache.custos.scim;
+//
+//import org.springframework.boot.SpringApplication;
+//import org.springframework.boot.autoconfigure.SpringBootApplication;
+//import org.springframework.context.annotation.ComponentScan;
+//
+////@SpringBootApplication
+////@ComponentScan(basePackages = "org.apache.custos")
+////public class SCIMServiceInitializer {
+////    public static void main(String[] args) {
+////        SpringApplication.run(SCIMServiceInitializer.class, args);
+////    }
+////}
diff --git a/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/manager/ResourceManager.java b/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/manager/ResourceManager.java
index 5b1bd5e65..ae4999975 100644
--- a/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/manager/ResourceManager.java
+++ b/custos-services/custos-integration-services/scim-service/src/main/java/org/apache/custos/scim/resource/manager/ResourceManager.java
@@ -83,8 +83,9 @@ public class ResourceManager implements UserManager {
     private CredentialStoreServiceClient credentialStoreServiceClient;
 
 
-    public ResourceManager(@Value("${scim.resource.user.endpoint}") String userEndpoint,
-                           @Value("${scim.resource.group.endpoint}") String groupEndpoint) {
+    public ResourceManager(@Value("${scim.resource.user.endpoint:/v2/Users}") String userEndpoint,
+                           @Value("${scim.resource.group.endpoint:/v2/Groups}") String groupEndpoint,
+                           @Value("${scim.user.schema.location}") String location) {
 
         Map<String, String> endpointMap = new HashMap();
         endpointMap.put(SCIMConstants.USER_ENDPOINT, userEndpoint);
@@ -93,7 +94,7 @@ public class ResourceManager implements UserManager {
 
         try {
             SCIMUserSchemaExtensionBuilder.getInstance()
-                    .buildUserSchemaExtension(Constants.USER_SCHEMA_EXTENTION_LOCATION);
+                    .buildUserSchemaExtension(location);
         } catch (Exception e) {
             String msg = "User schema building error";
             LOGGER.error(msg, e);