From 6a4c45f13354a64580d5772335ba7a06dfe383ab Mon Sep 17 00:00:00 2001 From: Puja Sharma Date: Thu, 7 Apr 2022 19:46:14 +0530 Subject: [PATCH] fix: scim user management endpoint failing due to conflict with user mgmt path --- jans-cli/cli/jca.yaml | 7 ++++--- jans-config-api/docs/jans-config-api-swagger.yaml | 6 +++--- .../io/jans/configapi/plugin/scim/rest/ScimResource.java | 2 +- .../src/test/resources/karate-config-jenkins.js | 2 +- .../scim-plugin/src/test/resources/karate-config.js | 2 +- .../server/src/main/resources/config-api-rs-protect.json | 6 +++--- .../io/jans/orm/model/base/CustomObjectAttribute.java | 9 ++++++--- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/jans-cli/cli/jca.yaml b/jans-cli/cli/jca.yaml index 30ba1f40938..55f8292601c 100644 --- a/jans-cli/cli/jca.yaml +++ b/jans-cli/cli/jca.yaml @@ -2585,7 +2585,8 @@ paths: security: - oauth2: [https://jans.io/oauth/config/user.write] - /jans-config-api/scim/user: + + /jans-config-api/scim/resource/user: get: tags: - SCIM - User Management @@ -2735,7 +2736,7 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' - /jans-config-api/scim/user/{id}: + /jans-config-api/scim/resource/user/{id}: get: tags: - SCIM - User Management @@ -2986,7 +2987,7 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' - /jans-config-api/scim/user/.search: + /jans-config-api/scim/resource/user/.search: post: tags: - SCIM - User Management diff --git a/jans-config-api/docs/jans-config-api-swagger.yaml b/jans-config-api/docs/jans-config-api-swagger.yaml index 870e6c8c82d..7f91f3a5c71 100644 --- a/jans-config-api/docs/jans-config-api-swagger.yaml +++ b/jans-config-api/docs/jans-config-api-swagger.yaml @@ -2555,7 +2555,7 @@ paths: - oauth2: [https://jans.io/oauth/config/user.delete] - /jans-config-api/scim/user: + /jans-config-api/scim/resource/user: get: tags: - SCIM - User Management @@ -2705,7 +2705,7 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' - /jans-config-api/scim/user/{id}: + /jans-config-api/scim/resource/user/{id}: get: tags: - SCIM - User Management @@ -2956,7 +2956,7 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' - /jans-config-api/scim/user/.search: + /jans-config-api/scim/resource/user/.search: post: tags: - SCIM - User Management diff --git a/jans-config-api/plugins/scim-plugin/src/main/java/io/jans/configapi/plugin/scim/rest/ScimResource.java b/jans-config-api/plugins/scim-plugin/src/main/java/io/jans/configapi/plugin/scim/rest/ScimResource.java index cdaa7e2f518..7b1bff6ddc1 100644 --- a/jans-config-api/plugins/scim-plugin/src/main/java/io/jans/configapi/plugin/scim/rest/ScimResource.java +++ b/jans-config-api/plugins/scim-plugin/src/main/java/io/jans/configapi/plugin/scim/rest/ScimResource.java @@ -23,7 +23,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -@Path("/user") +@Path("/resource/user") public class ScimResource { public static final String SEARCH_SUFFIX = ".search"; diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config-jenkins.js index bf39ae8c4f2..41a41720755 100644 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config-jenkins.js +++ b/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config-jenkins.js @@ -44,7 +44,7 @@ function() { accessToken: '123', //scim - scim_user_url: baseUrl + '/jans-config-api/scim/user', + scim_user_url: baseUrl + '/jans-config-api/scim/resource/user', scim_config_url: baseUrl + '/jans-config-api/scim/config', }; diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config.js index 85eae142b75..fb6ce5dca47 100644 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config.js +++ b/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config.js @@ -45,7 +45,7 @@ function() { //scim - scim_user_url: baseUrl + '/jans-config-api/scim/user', + scim_user_url: baseUrl + '/jans-config-api/scim/resource/user', scim_config_url: baseUrl + '/jans-config-api/scim/config', }; diff --git a/jans-config-api/server/src/main/resources/config-api-rs-protect.json b/jans-config-api/server/src/main/resources/config-api-rs-protect.json index 7534547dce5..592169f1d90 100644 --- a/jans-config-api/server/src/main/resources/config-api-rs-protect.json +++ b/jans-config-api/server/src/main/resources/config-api-rs-protect.json @@ -592,7 +592,7 @@ ] }, { - "path":"/jans-config-api/scim/user", + "path":"/jans-config-api/scim/resource/user", "conditions":[ { "httpMethods":["GET"], @@ -612,7 +612,7 @@ ] }, { - "path":"/jans-config-api/scim/user/{id}", + "path":"/jans-config-api/scim/resource/user/{id}", "conditions":[ { "httpMethods":["GET"], @@ -646,7 +646,7 @@ ] }, { - "path":"/jans-config-api/scim/user/.search", + "path":"/jans-config-api/scim/resource/user/.search", "conditions":[ { "httpMethods":["GET"], diff --git a/jans-orm/model/src/main/java/io/jans/orm/model/base/CustomObjectAttribute.java b/jans-orm/model/src/main/java/io/jans/orm/model/base/CustomObjectAttribute.java index f3f13484786..1baaf3fd2fa 100644 --- a/jans-orm/model/src/main/java/io/jans/orm/model/base/CustomObjectAttribute.java +++ b/jans-orm/model/src/main/java/io/jans/orm/model/base/CustomObjectAttribute.java @@ -92,9 +92,12 @@ public String getDisplayValue() { return values.get(0).toString(); } - StringBuilder sb = new StringBuilder(values.get(0).toString()); - for (int i = 1; i < values.size(); i++) { - sb.append(", ").append(values.get(i).toString()); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < values.size(); i++) { + if (i > 0) { + sb.append(", "); + } + sb.append(values.get(i).toString()); } return sb.toString();