From 8e9d43e1c33f4c7a7b8b705e2d04c50330eff3b1 Mon Sep 17 00:00:00 2001 From: pujavs <43700552+pujavs@users.noreply.github.com> Date: Fri, 24 Jan 2025 22:10:17 +0530 Subject: [PATCH] fix(config-api): asset upload config and saml document store changes (#10734) * feat(config-api): testng framework changes Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework - wip Signed-off-by: pujavs * feat(config-api): testng framework wip Signed-off-by: pujavs * feat(config-api): testng framework wip Signed-off-by: pujavs * feat(config-api): testng framework wip Signed-off-by: pujavs * feat(config-api): sync with main Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api) testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framework Signed-off-by: pujavs * feat(config-api): testng framwork Signed-off-by: pujavs --------- Signed-off-by: pujavs --- jans-config-api/common/pom.xml | 6 - .../docs/jans-config-api-swagger.yaml | 24 +- .../plugins/admin-ui-plugin/pom.xml | 74 +- .../rest/logging/AuditLoggerResource.java | 1 - .../ca/plugin/adminui/AdminUIBaseTest.java | 77 + .../ca/plugin/adminui/KarateTestRunner.java | 19 - .../TestAdminUIPluginJenkinsRunner.java | 43 - .../test/AuditLoggingResourceTest.java | 46 + .../adminui/test/LicenseResourceTest.java | 45 + .../adminui/test/OAuth2ResourceTest.java | 64 + .../auth/auditLogging.feature | 0 .../{feature => json}/auth/license.feature | 0 .../{feature => json}/auth/oauth2.feature | 0 .../resources/json/logging/logging-post.json | 5 + .../test/resources/karate-config-jenkins.js | 71 - .../src/test/resources/karate-config.js | 66 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 46 +- .../src/test/resources/testng.xml | 30 + .../plugins/docs/lock-plugin-swagger.yaml | 27 +- .../plugins/docs/user-mgt-plugin-swagger.yaml | 4 +- jans-config-api/plugins/fido2-plugin/pom.xml | 68 +- .../io/jans/configapi/KarateTestRunner.java | 18 - .../io/jans/configapi/TestJenkinsRunner.java | 44 - .../configapi/plugin/fido2/Fido2BaseTest.java | 33 + .../plugin/fido2/test/Fido2ResourceTest.java | 36 + .../{feature => json}/fido2/dynamiconf.json | 0 .../{feature => json}/fido2/fido2.feature | 0 .../{feature => json}/fido2/fido2.json | 0 .../fido2/ref_dynami_conf.json | 0 .../test/resources/karate-config-jenkins.js | 58 - .../src/test/resources/karate-config.js | 57 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 13 +- .../src/test/resources/testClient.feature | 13 - .../src/test/resources/testng.xml | 19 + .../src/test/resources/token.feature | 45 - .../plugins/jans-link-plugin/pom.xml | 66 +- .../io/jans/configapi/KarateTestRunner.java | 18 - .../io/jans/configapi/TestJenkinsRunner.java | 44 - .../configapi/plugin/link/LinkBaseTest.java | 31 + .../link/test/JansLinkConfigResourceTest.java | 38 + .../{feature => json}/link/dynamiconf.json | 0 .../link/link-config.feature | 0 .../test/resources/karate-config-jenkins.js | 58 - .../src/test/resources/karate-config.js | 57 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 14 +- .../src/test/resources/testClient.feature | 13 - .../src/test/resources/testng.xml | 19 + .../src/test/resources/token.feature | 45 - .../plugins/kc-link-plugin/pom.xml | 66 +- .../io/jans/configapi/KarateTestRunner.java | 18 - .../io/jans/configapi/TestJenkinsRunner.java | 44 - .../plugin/kc/link/KcLinkBaseTest.java | 32 + .../test/JansKcLinkConfigResourceTest.java | 36 + .../kc-link/kc-link-config.feature | 0 .../test/resources/karate-config-jenkins.js | 58 - .../src/test/resources/karate-config.js | 57 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 13 +- .../src/test/resources/testClient.feature | 13 - .../src/test/resources/testng.xml | 19 + .../src/test/resources/token.feature | 45 - .../plugins/kc-saml-plugin/pom.xml | 66 +- .../io/jans/configapi/TestJenkinsRunner.java | 44 - .../configapi/plugin/saml/KcSAMLBaseTest.java | 32 + .../plugin/saml/test/JansIdpResourceTest.java | 36 + .../test/JansKcSAMLConfigResourceTest.java | 37 + .../test/JansKcSAMLTrustRelationshipTest.java | 37 + .../saml/config/saml.feature | 0 .../saml-trust-relationship.feature | 0 .../test/resources/karate-config-jenkins.js | 59 - .../src/test/resources/karate-config.js | 58 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 16 +- .../src/test/resources/testClient.feature | 13 - .../src/test/resources/testng.xml | 21 + .../src/test/resources/token.feature | 45 - jans-config-api/plugins/lock-plugin/pom.xml | 66 +- .../io/jans/configapi/KarateTestRunner.java | 18 - .../io/jans/configapi/TestJenkinsRunner.java | 44 - .../configapi/plugin/lock/LockBaseTest.java | 32 + .../lock/test/LockAuditResourceTest.java | 54 + .../lock/test/LockConfigResourceTest.java | 37 + .../json/lock/lock-audit-health-post.json | 6 + .../json/lock/lock-audit-log-post.json | 9 + .../json/lock/lock-audit-telemetry-post.json | 15 + .../lock/lock-config.feature | 0 .../test/resources/karate-config-jenkins.js | 58 - .../src/test/resources/karate-config.js | 57 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 24 +- .../src/test/resources/testClient.feature | 13 - .../lock-plugin/src/test/resources/testng.xml | 20 + .../src/test/resources/token.feature | 45 - jans-config-api/plugins/scim-plugin/pom.xml | 66 +- .../io/jans/configapi/JenkinsTestRunner.java | 47 - .../io/jans/configapi/KarateTestRunner.java | 18 - .../configapi/plugin/scim/ScimBaseTest.java | 36 + .../scim/test/ScimConfigResourceTest.java | 37 + .../scim/config/scim-config.feature | 0 .../test/resources/karate-config-jenkins.js | 58 - .../src/test/resources/karate-config.js | 59 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 15 +- .../src/test/resources/testClient.feature | 13 - .../scim-plugin/src/test/resources/testng.xml | 19 + .../src/test/resources/token.feature | 45 - .../plugins/user-mgt-plugin/pom.xml | 66 +- .../io/jans/configapi/JenkinsTestRunner.java | 47 - .../io/jans/configapi/KarateTestRunner.java | 18 - .../configapi/plugin/mgt/UserBaseTest.java | 31 + .../plugin/mgt/test/UserResourceTest.java | 37 + .../mgt/user/user-patch.json | 0 .../{feature => json}/mgt/user/user-ref.json | 0 .../{feature => json}/mgt/user/user.feature | 0 .../{feature => json}/mgt/user/user.json | 0 .../test/resources/karate-config-jenkins.js | 58 - .../src/test/resources/karate-config.js | 59 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../src/test/resources/test.properties | 13 +- .../src/test/resources/testClient.feature | 13 - .../src/test/resources/testng.xml | 19 + .../src/test/resources/token.feature | 45 - jans-config-api/pom.xml | 64 +- jans-config-api/server/pom.xml | 69 +- .../jans/configapi/ConfigServerBaseTest.java} | 9 +- .../io/jans/configapi/JenkinsTestRunner.java | 47 - .../io/jans/configapi/KarateTestRunner.java | 18 - .../rest/resource/ConfigResourceTest.java | 25 - .../configapi/test/auth/AcrsResourceTest.java | 55 + .../auth/AgamaDeploymentsResourceTest.java | 36 + .../test/auth/AuthConfigResourceTest.java | 73 + .../test/auth/ClientResourceTest.java | 55 + .../test/auth/ConfigResourceTest.java | 55 + .../configapi/test/health/ApiHealthTest.java | 70 + .../agama/agama-deployment.feature | 0 .../{feature => json}/agama/agama-source.txt | 0 .../{feature => json}/agama/agama.feature | 0 .../{feature => json}/agama/agama.json | 0 .../{feature => json}/agama/agama1.json | 0 .../attribute/attribute-for-patch.json | 0 .../attribute/attribute.json | 0 .../attribute/attributes.feature | 0 .../client-auth/client-auth.feature | 0 .../json/config/api/api-config-patch.json | 5 + .../config/api/properties.feature | 0 .../json/config/auth/auth-config-patch.json | 5 + .../config/cache/cache.feature | 0 .../database/ldap/get-ldap-config.feature | 0 .../config/database/ldap/ldap.feature | 0 .../config/database/ldap/ldap.json | 0 .../config/database/ldap/ldap_list.json | 0 .../config/jwks/jwk_key.json | 0 .../config/jwks/jwks-all.json | 0 .../config/jwks/jwks.feature | 0 .../{feature => json}/config/jwks/jwks.json | 0 .../config/jwks/jwks_patch.json | 0 .../config/message/message.feature | 0 .../config/org/org-config.feature | 0 .../properties/authenticationFilters.json | 0 .../backchannel/backchannel.feature | 0 .../config/properties/ciba/ciba.feature | 0 .../config/properties/ciba/ciba.json | 0 .../clientAuthenticationFilters.json | 0 .../config/properties/cors/cors.feature | 0 .../config/properties/cors/cors.json | 0 .../config/properties/custom.json | 0 .../dynamic/registration/registration.feature | 0 .../dynamic/registration/registration.json | 0 .../properties/endpoints/endpoints.feature | 0 .../properties/endpoints/endpoints.json | 0 .../properties/expiration/expiration.feature | 0 .../properties/expiration/expiration.json | 0 .../config/properties/grant/grant.feature | 0 .../config/properties/grant/grant.json | 0 .../config/properties/idToken/idToken.feature | 0 .../config/properties/idToken/idToken.json | 0 .../janssenpkcs/janssenpkcs.feature | 0 .../properties/keys/regen/regen.feature | 0 .../config/properties/keys/regen/regen.json | 0 .../config/properties/metrics/metrics.feature | 0 .../properties/openid/config/config.feature | 0 .../properties/openid/config/config.json | 0 .../properties/pairwise/pairwise.feature | 0 .../config/properties/properties.feature | 0 .../config/properties/request/object.feature | 0 .../properties/response/modes/modes.feature | 0 .../properties/response/types/type.feature | 0 .../config/properties/server/cleanup.feature | 0 .../config/properties/server/cleanup.json | 0 .../config/properties/server/config.feature | 0 .../config/properties/server/config.json | 0 .../server/session/sessionId.feature | 0 .../config/properties/subject/subject.feature | 0 .../config/properties/subject/subject.json | 0 .../config/properties/token/token.feature | 0 .../config/properties/token/token.json | 0 .../uma/configuration/configuration.feature | 0 .../properties/user/info/userInfo.feature | 0 .../scripts/custom/generic/all-script.json | 0 .../scripts/custom/generic/custom.feature | 0 .../scripts/custom/generic/post-script.json | 0 .../scripts/custom/persons/person-script.json | 0 .../custom/persons/person-scripts.feature | 0 .../defaultAcr/defaultAcr.feature | 0 .../defaultAcr/defaultAcr.json | 0 .../health/auth-server-health.feature | 0 .../health/config-api-health.feature | 0 .../health/server-health.feature | 0 .../{feature => json}/logging/logging.feature | 0 .../openid/clients/admin-ui-client.json | 0 .../openid/clients/client.json | 0 .../client_custom_attribute_patch.json | 0 .../openid/clients/clients.feature | 0 .../openid/clients/custom-attribute.feature | 0 .../openid/clients/openid-client-get.json | 1420 +++++++++++++++++ .../openid/clients/openid-client-post.json | 53 + .../openid/clients/openid-client.json | 0 .../openid/clients/openid_clients_create.json | 0 .../openid/scopes/generic_scopes.feature | 0 .../openid/scopes/scope.json | 0 .../openid/scopes/scopes-all.json | 0 .../openid/scopes/scopes.feature | 0 .../{feature => json}/plugins/plugin-all.json | 0 .../{feature => json}/plugins/plugin.feature | 0 .../{feature => json}/session/session.feature | 0 .../{feature => json}/smtp/smtp.feature | 0 .../{feature => json}/smtp/smtp.json | 0 .../{feature => json}/stat/stat.feature | 0 .../token/client-token.feature | 0 .../uma/resource/resources.feature | 0 .../uma/resource/uma-resource.json | 0 .../uma/scopes/uma-scope.json | 0 .../uma/scopes/umascopes.feature | 0 .../test/resources/karate-config-jenkins.js | 82 - .../src/test/resources/karate-config.js | 82 - .../src/test/resources/karate.properties | 5 - .../test/resources/karate_jenkins.properties | 2 - .../server/src/test/resources/log4j2-test.xml | 21 + .../server/src/test/resources/test.properties | 66 +- .../src/test/resources/testClient.feature | 13 - .../server/src/test/resources/testng.xml | 43 + .../server/src/test/resources/token.feature | 45 - jans-config-api/shared/pom.xml | 10 + .../io/jans/configapi/core/test/BaseTest.java | 203 +++ .../test/listener/AlterSuiteListener.java | 83 + .../test/listener/ApiUnitTestListener.java | 77 + .../core/test/listener/PersistenceType.java | 15 + .../core/test/listener/SkipTest.java | 17 + .../core/test/listener/SkipTestsListener.java | 39 + .../core/test/service/HttpService.java | 373 +++++ .../core/test/service/ResteasyService.java | 117 ++ .../core/test/service/TokenService.java | 82 + 263 files changed, 4311 insertions(+), 2816 deletions(-) create mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/AdminUIBaseTest.java delete mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/KarateTestRunner.java delete mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/TestAdminUIPluginJenkinsRunner.java create mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/AuditLoggingResourceTest.java create mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/LicenseResourceTest.java create mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/OAuth2ResourceTest.java rename jans-config-api/plugins/admin-ui-plugin/src/test/resources/{feature => json}/auth/auditLogging.feature (100%) rename jans-config-api/plugins/admin-ui-plugin/src/test/resources/{feature => json}/auth/license.feature (100%) rename jans-config-api/plugins/admin-ui-plugin/src/test/resources/{feature => json}/auth/oauth2.feature (100%) create mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/logging/logging-post.json delete mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate_jenkins.properties create mode 100644 jans-config-api/plugins/admin-ui-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java create mode 100644 jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/Fido2BaseTest.java create mode 100644 jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/test/Fido2ResourceTest.java rename jans-config-api/plugins/fido2-plugin/src/test/resources/{feature => json}/fido2/dynamiconf.json (100%) rename jans-config-api/plugins/fido2-plugin/src/test/resources/{feature => json}/fido2/fido2.feature (100%) rename jans-config-api/plugins/fido2-plugin/src/test/resources/{feature => json}/fido2/fido2.json (100%) rename jans-config-api/plugins/fido2-plugin/src/test/resources/{feature => json}/fido2/ref_dynami_conf.json (100%) delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/fido2-plugin/src/test/resources/token.feature delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java create mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/LinkBaseTest.java create mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/test/JansLinkConfigResourceTest.java rename jans-config-api/plugins/jans-link-plugin/src/test/resources/{feature => json}/link/dynamiconf.json (100%) rename jans-config-api/plugins/jans-link-plugin/src/test/resources/{feature => json}/link/link-config.feature (100%) delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/jans-link-plugin/src/test/resources/token.feature delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java create mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/KcLinkBaseTest.java create mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/test/JansKcLinkConfigResourceTest.java rename jans-config-api/plugins/kc-link-plugin/src/test/resources/{feature => json}/kc-link/kc-link-config.feature (100%) delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/kc-link-plugin/src/test/resources/token.feature delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java create mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/KcSAMLBaseTest.java create mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansIdpResourceTest.java create mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLConfigResourceTest.java create mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLTrustRelationshipTest.java rename jans-config-api/plugins/kc-saml-plugin/src/test/resources/{feature => json}/saml/config/saml.feature (100%) rename jans-config-api/plugins/kc-saml-plugin/src/test/resources/{feature => json}/saml/trust-relationship/saml-trust-relationship.feature (100%) delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/kc-saml-plugin/src/test/resources/token.feature delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java create mode 100644 jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/LockBaseTest.java create mode 100644 jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockAuditResourceTest.java create mode 100644 jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockConfigResourceTest.java create mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-health-post.json create mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-log-post.json create mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-telemetry-post.json rename jans-config-api/plugins/lock-plugin/src/test/resources/{feature => json}/lock/lock-config.feature (100%) delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/lock-plugin/src/test/resources/token.feature delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java create mode 100644 jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/ScimBaseTest.java create mode 100644 jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/test/ScimConfigResourceTest.java rename jans-config-api/plugins/scim-plugin/src/test/resources/{feature => json}/scim/config/scim-config.feature (100%) delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/scim-plugin/src/test/resources/token.feature delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java create mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/UserBaseTest.java create mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/test/UserResourceTest.java rename jans-config-api/plugins/user-mgt-plugin/src/test/resources/{feature => json}/mgt/user/user-patch.json (100%) rename jans-config-api/plugins/user-mgt-plugin/src/test/resources/{feature => json}/mgt/user/user-ref.json (100%) rename jans-config-api/plugins/user-mgt-plugin/src/test/resources/{feature => json}/mgt/user/user.feature (100%) rename jans-config-api/plugins/user-mgt-plugin/src/test/resources/{feature => json}/mgt/user/user.json (100%) delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config.js delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate.properties delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate_jenkins.properties delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/testClient.feature create mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/testng.xml delete mode 100644 jans-config-api/plugins/user-mgt-plugin/src/test/resources/token.feature rename jans-config-api/{plugins/kc-saml-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java => server/src/test/java/io/jans/configapi/ConfigServerBaseTest.java} (51%) delete mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/JenkinsTestRunner.java delete mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/KarateTestRunner.java delete mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/rest/resource/ConfigResourceTest.java create mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AcrsResourceTest.java create mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AgamaDeploymentsResourceTest.java create mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AuthConfigResourceTest.java create mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ClientResourceTest.java create mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ConfigResourceTest.java create mode 100644 jans-config-api/server/src/test/java/io/jans/configapi/test/health/ApiHealthTest.java rename jans-config-api/server/src/test/resources/{feature => json}/agama/agama-deployment.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/agama/agama-source.txt (100%) rename jans-config-api/server/src/test/resources/{feature => json}/agama/agama.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/agama/agama.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/agama/agama1.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/attribute/attribute-for-patch.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/attribute/attribute.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/attribute/attributes.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/client-auth/client-auth.feature (100%) create mode 100644 jans-config-api/server/src/test/resources/json/config/api/api-config-patch.json rename jans-config-api/server/src/test/resources/{feature => json}/config/api/properties.feature (100%) create mode 100644 jans-config-api/server/src/test/resources/json/config/auth/auth-config-patch.json rename jans-config-api/server/src/test/resources/{feature => json}/config/cache/cache.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/database/ldap/get-ldap-config.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/database/ldap/ldap.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/database/ldap/ldap.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/database/ldap/ldap_list.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/jwks/jwk_key.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/jwks/jwks-all.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/jwks/jwks.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/jwks/jwks.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/jwks/jwks_patch.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/message/message.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/org/org-config.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/authenticationFilters.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/backchannel/backchannel.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/ciba/ciba.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/ciba/ciba.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/clientAuthenticationFilters.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/cors/cors.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/cors/cors.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/custom.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/dynamic/registration/registration.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/dynamic/registration/registration.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/endpoints/endpoints.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/endpoints/endpoints.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/expiration/expiration.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/expiration/expiration.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/grant/grant.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/grant/grant.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/idToken/idToken.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/idToken/idToken.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/janssenpkcs/janssenpkcs.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/keys/regen/regen.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/keys/regen/regen.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/metrics/metrics.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/openid/config/config.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/openid/config/config.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/pairwise/pairwise.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/properties.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/request/object.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/response/modes/modes.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/response/types/type.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/server/cleanup.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/server/cleanup.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/server/config.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/server/config.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/server/session/sessionId.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/subject/subject.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/subject/subject.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/token/token.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/token/token.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/uma/configuration/configuration.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/properties/user/info/userInfo.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/scripts/custom/generic/all-script.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/scripts/custom/generic/custom.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/scripts/custom/generic/post-script.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/scripts/custom/persons/person-script.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/config/scripts/custom/persons/person-scripts.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/defaultAcr/defaultAcr.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/defaultAcr/defaultAcr.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/health/auth-server-health.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/health/config-api-health.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/health/server-health.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/logging/logging.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/admin-ui-client.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/client.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/client_custom_attribute_patch.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/clients.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/custom-attribute.feature (100%) create mode 100644 jans-config-api/server/src/test/resources/json/openid/clients/openid-client-get.json create mode 100644 jans-config-api/server/src/test/resources/json/openid/clients/openid-client-post.json rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/openid-client.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/clients/openid_clients_create.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/scopes/generic_scopes.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/scopes/scope.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/scopes/scopes-all.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/openid/scopes/scopes.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/plugins/plugin-all.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/plugins/plugin.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/session/session.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/smtp/smtp.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/smtp/smtp.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/stat/stat.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/token/client-token.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/uma/resource/resources.feature (100%) rename jans-config-api/server/src/test/resources/{feature => json}/uma/resource/uma-resource.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/uma/scopes/uma-scope.json (100%) rename jans-config-api/server/src/test/resources/{feature => json}/uma/scopes/umascopes.feature (100%) delete mode 100644 jans-config-api/server/src/test/resources/karate-config-jenkins.js delete mode 100644 jans-config-api/server/src/test/resources/karate-config.js delete mode 100644 jans-config-api/server/src/test/resources/karate.properties delete mode 100644 jans-config-api/server/src/test/resources/karate_jenkins.properties create mode 100644 jans-config-api/server/src/test/resources/log4j2-test.xml delete mode 100644 jans-config-api/server/src/test/resources/testClient.feature create mode 100644 jans-config-api/server/src/test/resources/testng.xml delete mode 100644 jans-config-api/server/src/test/resources/token.feature create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/BaseTest.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/AlterSuiteListener.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/ApiUnitTestListener.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/PersistenceType.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTest.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTestsListener.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/HttpService.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/ResteasyService.java create mode 100644 jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/TokenService.java diff --git a/jans-config-api/common/pom.xml b/jans-config-api/common/pom.xml index a33c08a4ec7..f8a30e49d70 100644 --- a/jans-config-api/common/pom.xml +++ b/jans-config-api/common/pom.xml @@ -39,12 +39,6 @@ maven-surefire-plugin - - true - - --tags ~@ignore - - diff --git a/jans-config-api/docs/jans-config-api-swagger.yaml b/jans-config-api/docs/jans-config-api-swagger.yaml index d46e4c60864..30c292ee968 100644 --- a/jans-config-api/docs/jans-config-api-swagger.yaml +++ b/jans-config-api/docs/jans-config-api-swagger.yaml @@ -9335,22 +9335,22 @@ components: $ref: '#/components/schemas/AttributeValidation' tooltip: type: string - selected: + whitePagesCanView: type: boolean userCanAccess: type: boolean adminCanAccess: type: boolean - whitePagesCanView: - type: boolean adminCanView: type: boolean - userCanEdit: - type: boolean adminCanEdit: type: boolean + userCanEdit: + type: boolean userCanView: type: boolean + selected: + type: boolean baseDn: type: string PatchRequest: @@ -10351,8 +10351,10 @@ components: type: string finishedFlowPage: type: string - bridgeScriptPage: - type: string + startEndUrlMapping: + type: object + additionalProperties: + type: string serializeRules: type: object additionalProperties: @@ -10988,10 +10990,10 @@ components: type: array items: type: object - value: - type: object displayValue: type: string + value: + type: object LocalizedString: type: object properties: @@ -11331,14 +11333,14 @@ components: type: boolean internal: type: boolean + locationPath: + type: string locationType: type: string enum: - ldap - db - file - locationPath: - type: string baseDn: type: string ScriptError: diff --git a/jans-config-api/plugins/admin-ui-plugin/pom.xml b/jans-config-api/plugins/admin-ui-plugin/pom.xml index c47467970a1..38d18d0ee0f 100644 --- a/jans-config-api/plugins/admin-ui-plugin/pom.xml +++ b/jans-config-api/plugins/admin-ui-plugin/pom.xml @@ -31,42 +31,18 @@ commons-collections 3.2.2 + io.rest-assured rest-assured test - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test - - - junit - junit - - + + org.testng + testng + test + jakarta.xml.bind jakarta.xml.bind-api @@ -90,15 +66,19 @@ admin-ui-plugin + + + ../../profiles/${cfg}/config-build.properties + ../../profiles/${cfg}/config-api-test.properties + + src/test/resources true - - *.* - + org.apache.maven.plugins @@ -118,29 +98,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - - integration - - --tags ~@ignore - - - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - + + + target/test-classes/testng.xml + + org.apache.maven.plugins diff --git a/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/rest/logging/AuditLoggerResource.java b/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/rest/logging/AuditLoggerResource.java index 9e2d5461524..89cffb66938 100644 --- a/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/rest/logging/AuditLoggerResource.java +++ b/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/rest/logging/AuditLoggerResource.java @@ -25,7 +25,6 @@ public class AuditLoggerResource { @Inject Logger log; - @POST @Path(AUDIT) @ProtectedApi(scopes = {AUDIT_LOGGING_WRITE_SCOPE}) diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/AdminUIBaseTest.java b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/AdminUIBaseTest.java new file mode 100644 index 00000000000..cee2610b1d3 --- /dev/null +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/AdminUIBaseTest.java @@ -0,0 +1,77 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.ca.plugin.adminui; + +import io.jans.configapi.core.test.BaseTest; + +import java.io.UnsupportedEncodingException; +import java.util.Map; +import java.util.HashMap; +import jakarta.ws.rs.core.Response; + +import org.apache.http.entity.ContentType; +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class AdminUIBaseTest extends BaseTest { + + // Execute before each test is run + @BeforeMethod + protected void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("auditLoggingURL"), accessToken); + log.error("\n\n\n *********************** ADMIN-UI Plugin isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + + // skipped as well + if (!isAvailable) { + throw new SkipException("ADMIN-UI Plugin Not deployed"); + } else { + log.info("\n\n\n *** ADMIN-UI Plugin is Deployed {}", "\n\n"); + } + } + + public void authorize() { + log.info("AdminUI - getAccessToken - propertiesMap:{}", propertiesMap); + + String authzurl = propertiesMap.get("test.authzurl"); + String strGrantType = propertiesMap.get("test.grant.type"); + String clientId = propertiesMap.get("test.client.id"); + String clientSecret = propertiesMap.get("test.client.secret"); + String scopes = propertiesMap.get("test.scopes"); + String responseType = propertiesMap.get("test.response.type"); + String redirectUri = propertiesMap.get("test.redirect.uri"); + log.info( + "\n\n\n\n ************ AdminUI- authzurl:{}, strGrantType:{}, clientId:{}, clientSecret:{}, scopes:{}, responseType:{}, propertiesMap.get(auditLoggingURL)", + authzurl, strGrantType, clientId, clientSecret, scopes, responseType, + propertiesMap.get("auditLoggingURL")); + Map params = new HashMap<>(); + params.put("client_id", clientId); + params.put("scope", scopes); + params.put("grant_type", strGrantType); + params.put("response_type", responseType); + params.put("redirect_uri", redirectUri); + Response response = authorize(authzurl, clientId, clientSecret, null, getAuthCode(clientId, clientSecret), + params, null); + log.info("\n\n\n\n AdminUI- response:{} :{}", response, "**********"); + } + + private String getAuthCode(final String clientId, final String clientSecret) { + String code = null; + try { + code = getCredentials(clientId, clientSecret); + } catch (UnsupportedEncodingException ex) { + log.error("Error while encoding credentials is ", ex); + } + return code; + } + + private Response authorize(final String authzurl, final Map parameters, + ContentType contentType) { + return executePost(authzurl, clientId, clientSecret, authType, authCode, parameters, contentType); + } + +} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/KarateTestRunner.java b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/KarateTestRunner.java deleted file mode 100644 index a9d07255f2f..00000000000 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/KarateTestRunner.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.ca.plugin.adminui; - -import com.intuit.karate.junit5.Karate; -import org.junit.jupiter.api.Test; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/TestAdminUIPluginJenkinsRunner.java b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/TestAdminUIPluginJenkinsRunner.java deleted file mode 100644 index 466e942a336..00000000000 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/TestAdminUIPluginJenkinsRunner.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.ca.plugin.adminui; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Yuriy Zabrovarnyy - */ -public class TestAdminUIPluginJenkinsRunner { - - @Test - void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/AuditLoggingResourceTest.java b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/AuditLoggingResourceTest.java new file mode 100644 index 00000000000..fcc362934a8 --- /dev/null +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/AuditLoggingResourceTest.java @@ -0,0 +1,46 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.ca.plugin.adminui.test; + +import io.jans.ca.plugin.adminui.AdminUIBaseTest; + +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class AuditLoggingResourceTest extends AdminUIBaseTest { + + /** + * Testing Audit Logging endpoint + */ + @Parameters({ "test.issuer", "auditLoggingURL", "audit_post_1" }) + @Test + public void postAuditLoggingData(final String issuer, final String auditLoggingURL, final String json) { + log.info("\n\n postAuditLoggingData() - accessToken:{}, issuer:{}, auditLoggingURL:{}, json:{}", accessToken, + issuer, auditLoggingURL, json); + + Builder request = getResteasyService().getClientBuilder(issuer + auditLoggingURL); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.post(Entity.entity(json, MediaType.APPLICATION_JSON)); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + log.info("\n\n Response for postAuditLoggingData - response:{}, response.getStatus():{}", response, + response.getStatus()); + + } + +} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/LicenseResourceTest.java b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/LicenseResourceTest.java new file mode 100644 index 00000000000..6943cb2d3d6 --- /dev/null +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/LicenseResourceTest.java @@ -0,0 +1,45 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.ca.plugin.adminui.test; + +import io.jans.ca.plugin.adminui.AdminUIBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class LicenseResourceTest extends AdminUIBaseTest { + + /** + * Test License Details + */ + @Parameters({ "test.issuer", "checkActiveLicenseURL" }) + @Test + public void getLicenseDetails(final String issuer, final String checkActiveLicenseURL) { + log.info("getLicenseDetails() - accessToken:{}, issuer:{}, checkActiveLicenseURL:{}", accessToken, issuer, + checkActiveLicenseURL); + + Builder request = getResteasyService().getClientBuilder(issuer + checkActiveLicenseURL); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("\n\n Response for getLicenseDetails - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + +} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/OAuth2ResourceTest.java b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/OAuth2ResourceTest.java new file mode 100644 index 00000000000..1d3182a6996 --- /dev/null +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/java/io/jans/ca/plugin/adminui/test/OAuth2ResourceTest.java @@ -0,0 +1,64 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.ca.plugin.adminui.test; + +import io.jans.ca.plugin.adminui.AdminUIBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.MediaType; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class OAuth2ResourceTest extends AdminUIBaseTest { + + /** + * Testing oauth2 GET configuration endpoint + */ + @Parameters({ "test.issuer", "adminUIConfigURL" }) + @Test + public void getOAuth2Data(final String issuer, final String adminUIConfigURL) { + log.info("getOAuth2Data() - accessToken:{}, issuer:{}, adminUIConfigURL:{}", accessToken, issuer, + adminUIConfigURL); + + Builder request = getResteasyService().getClientBuilder(issuer + adminUIConfigURL); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getOAuth2Data() - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + + /** + * Testing api-protection-token GET endpoint + */ + @Parameters({ "test.issuer", "apiProtectionTokenURL", "ujwt" }) + @Test + public void getApiProtectionTokenData(final String issuer, final String apiProtectionTokenURL, final String ujwt) { + + before(); + log.info("\n\n getApiProtectionTokenData() - accessToken:{}, issuer:{}, apiProtectionTokenURL:{}, ujwt:{}", + accessToken, issuer, apiProtectionTokenURL, ujwt); + Builder request = getResteasyService().getClientBuilder(issuer + apiProtectionTokenURL); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); + request.property("ujwt", ujwt); + Response response = request.get(); + log.info("\n\n Response for getApiProtectionTokenData() - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } +} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/feature/auth/auditLogging.feature b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/auth/auditLogging.feature similarity index 100% rename from jans-config-api/plugins/admin-ui-plugin/src/test/resources/feature/auth/auditLogging.feature rename to jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/auth/auditLogging.feature diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/feature/auth/license.feature b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/auth/license.feature similarity index 100% rename from jans-config-api/plugins/admin-ui-plugin/src/test/resources/feature/auth/license.feature rename to jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/auth/license.feature diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/feature/auth/oauth2.feature b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/auth/oauth2.feature similarity index 100% rename from jans-config-api/plugins/admin-ui-plugin/src/test/resources/feature/auth/oauth2.feature rename to jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/auth/oauth2.feature diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/logging/logging-post.json b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/logging/logging-post.json new file mode 100644 index 00000000000..8e9fc817567 --- /dev/null +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/json/logging/logging-post.json @@ -0,0 +1,5 @@ +{ + "message": { + "childMsg": "Testing audit logging." + } +} \ No newline at end of file diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index 889c46d1fcb..00000000000 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,71 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - statUrl: baseUrl + '/jans-config-api/api/v1/stat', - healthUrl: baseUrl + '/jans-config-api/api/v1/health', - fido2Url: baseUrl + '/jans-config-api/api/v1/fido2/config', - acrsUrl: baseUrl + '/jans-config-api/api/v1/acrs', - authConfigurationUrl: baseUrl + '/jans-config-api/api/v1/jans-auth-server/config', - scriptsUrl: baseUrl + '/jans-config-api/api/v1/config/scripts', - cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache', - messageUrl: baseUrl + '/jans-config-api/api/v1/config/message', - jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks', - ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap', - openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients', - scopes_url: baseUrl + '/jans-config-api/api/v1/scopes', - umaresources_url: baseUrl + '/jans-config-api/api/v1/uma/resources', - attributes_url: baseUrl + '/jans-config-api/api/v1/attributes', - smtp_url: baseUrl + '/jans-config-api/api/v1/config/smtp', - logging_url: baseUrl + '/jans-config-api/api/v1/logging', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config.js deleted file mode 100644 index 9ef8e2cdb3c..00000000000 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,66 +0,0 @@ -function() { - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - - var grantType = testProps.get('test.grant.type'); - var clientId = testProps.get('test.client.id'); - var clientSecret = testProps.get('test.client.secret'); - var scopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - - karate.log(' grantType = '+grantType); - karate.log(' clientId = '+clientId); - karate.log(' clientSecret = '+clientSecret); - karate.log(' scopes = '+scopes); - karate.log(' issuer = '+issuer); - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - grantType: grantType, - clientId: clientId, - clientSecret: clientSecret, - scopes: scopes, - authzurl: issuer + '/jans-auth/authorize.htm', - adminUIConfigURL: issuer + '/jans-config-api/admin-ui/oauth2/config', - apiProtectionTokenURL: issuer + '/jans-config-api/admin-ui/oauth2/api-protection-token', - checkLicenseURL: issuer + '/jans-config-api/admin-ui/license/checkLicense', - getLicenseDetailsURL: issuer + '/jans-config-api/admin-ui/license/getLicenseDetails', - getLicenseDetailsURL: issuer + '/jans-config-api/admin-ui/license/getLicenseDetails', - getAuditLoggingURL: issuer + '/jans-config-api/admin-ui/logging/audit', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:authzCode.feature', config); - print(' result.response = '+result.response); - //config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/test.properties b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/test.properties index a327ce4a05b..ecfcfc9a365 100644 --- a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/test.properties @@ -1,6 +1,40 @@ -test.scopes=openid profile email user_name -test.grant.type=authorization_code -test.client.id=2073c8e7-1060-4c09-b0f6-7d46fb6ff8f5 -test.client.secret=92bc4d8e-2f4c-4a4d-80ae-1e4eb1f5f463 -test.issuer=https://admin-ui-test.gluu.org -test.authzurl=https://admin-ui-test.gluu.org/jans-auth/authorize.htm +test.scopes=${test.scopes} + +# Test env Setting +#token.endpoint=${token.endpoint} +#token.grant.type=${token.grant.type} +#test.client.id=${test.client.id} +#test.client.secret=${test.client.secret} +#test.issuer=${test.issuer} + +test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# Test env Setting +token.endpoint=https://pujavs-informed-boar.gluu.info/jans-auth/restv1/token +token.grant.type=client_credentials +test.client.id=1800.3f0358fa-d6f6-483e-a7a0-d2ca95609afc +test.client.secret=fA5wnwls35Ln +test.issuer=https://pujavs-informed-boar.gluu.info + + +#test.scopes=openid profile email user_name +#test.grant.type=authorization_code +#test.client.id=2002.e3728c16-00c8-43d8-947c-f3da4d76ef46 +#test.client.secret=niHMmgEP39Qm +#test.issuer=https://pujavs-willing-basilisk.gluu.info +#test.authzurl=https://pujavs-willing-basilisk.gluu.info/jans-auth/authorize.htm +#test.response.type=code +#test.redirect.uri=${test.issuer} +ujwt=eyJraWQiOiI2NmQ1ODk4Ny03NjQ0LTRkYjEtOWU2YS04ZmFiNWFjYWVhNjVfc2lnX3JzMjU2IiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJndFZ2cDJCMGlwdFN5bXFSTEpzc2ZZOWZNbjliWVZRNF8xVTBHSFlFWFRJIiwiYXVkIjoiMjA3M2M4ZTctMTA2MC00YzA5LWIwZjYtN2Q0NmZiNmZmOGY1IiwibmFtZSI6IkRlZmF1bHQgQWRtaW4gVXNlciIsIm5pY2tuYW1lIjoiQWRtaW4iLCJpc3MiOiJodHRwczovL2FkbWluLXVpLXRlc3QuZ2x1dS5vcmciLCJnaXZlbl9uYW1lIjoiQWRtaW4iLCJtaWRkbGVfbmFtZSI6IkFkbWluIiwiZmFtaWx5X25hbWUiOiJVc2VyIiwiamFuc0FkbWluVUlSb2xlIjpbImFwaS1hZG1pbiJdfQ.losuUsBib2YvB2t995iT0HJvE-q7uZT8zHrTJsWN8_rxB_-kawFNI6weWiH4hpAaIAIaw6Bnq5AczSW3OS6sn5fZDrBxuftrurCa7PK7uAeYim8Zozg0NHNQQ9FDe6MYg8FLtKI3eiusvgC3P4CClIFf1AMGVxREyBra87r_J8j2IyV86Ktjv_rVZLNm2mChOrbM5sIjaski4saKtZTMiVZoK7WMC4FJmS8ttysfG2w7-t8MoI9kiM890RhxSoUba9nQIVxKmpdJOzam8_FqNfQmC9fzI2XKjgRu16SoAoJxCNeTy8HHBCN4H_BwxgU2seSbDTMgU11GiApd4D2xaw + +#uri +authzurl=/jans-auth/authorize.htm +adminUIConfigURL=/jans-config-api/admin-ui/oauth2/config +apiProtectionTokenURL=/jans-config-api/admin-ui/oauth2/api-protection-token +checkActiveLicenseURL=/jans-config-api/admin-ui/license/isActive +licenseDetailsURL=/jans-config-api/admin-ui/license/getLicenseDetails +auditLoggingURL=/jans-config-api/admin-ui/logging/audit + + +#logging +audit_post_1=file:target/test-classes/json/logging/logging-post.json + diff --git a/jans-config-api/plugins/admin-ui-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..ee397a4beda --- /dev/null +++ b/jans-config-api/plugins/admin-ui-plugin/src/test/resources/testng.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/docs/lock-plugin-swagger.yaml b/jans-config-api/plugins/docs/lock-plugin-swagger.yaml index b75b56adade..2b0bbedc06a 100644 --- a/jans-config-api/plugins/docs/lock-plugin-swagger.yaml +++ b/jans-config-api/plugins/docs/lock-plugin-swagger.yaml @@ -671,9 +671,6 @@ components: tokenUrl: type: string description: Jans URL of the OpenID Connect Provider's OAuth 2.0 Token Endpoint - groupScopeEnabled: - type: boolean - description: Group scope enabled endpointGroups: type: object additionalProperties: @@ -707,9 +704,6 @@ components: externalLoggerConfiguration: type: string description: The path to the external log4j2 logging configuration - metricChannel: - type: string - description: Channel for metric reports metricReporterInterval: type: integer description: The interval for metric reporter in seconds @@ -725,11 +719,6 @@ components: type: integer description: Time interval for the Clean Service in seconds format: int32 - opaConfiguration: - $ref: '#/components/schemas/OpaConfiguration' - pdpType: - type: string - description: PDP type policiesJsonUrisAuthorizationToken: type: string description: Authorization token to access Json Uris @@ -748,18 +737,14 @@ components: items: type: string description: List of Zip Uris with policies - errorReasonEnabled: - type: boolean - OpaConfiguration: - type: object - properties: - baseUrl: + messageConsumerType: type: string - description: Base OPA URL - accessToken: + description: PubSub consumer service + policyConsumerType: type: string - description: OPA access token - description: Opa Configuration + description: Policy consumer service + errorReasonEnabled: + type: boolean JsonPatch: type: object JsonNode: diff --git a/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml b/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml index a23d9c4e828..9113a738b01 100644 --- a/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml +++ b/jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml @@ -863,10 +863,10 @@ components: type: array items: type: object - value: - type: object displayValue: type: string + value: + type: object CustomUser: type: object properties: diff --git a/jans-config-api/plugins/fido2-plugin/pom.xml b/jans-config-api/plugins/fido2-plugin/pom.xml index 08eeea05b3d..aca4cb0fc07 100644 --- a/jans-config-api/plugins/fido2-plugin/pom.xml +++ b/jans-config-api/plugins/fido2-plugin/pom.xml @@ -90,29 +90,9 @@ test - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -130,18 +110,12 @@ ../../profiles/${cfg}/config-api-test.properties - - - src/test/resources - true - - karate.properties - karate_jenkins.properties - test.properties - *.* - - - + + + src/test/resources + true + + @@ -177,29 +151,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java b/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java deleted file mode 100644 index a7f7d2d80c2..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class TestJenkinsRunner { - - @Test - void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/Fido2BaseTest.java b/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/Fido2BaseTest.java new file mode 100644 index 00000000000..b5006ebe2fc --- /dev/null +++ b/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/Fido2BaseTest.java @@ -0,0 +1,33 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.fido2; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class Fido2BaseTest extends BaseTest { + + // Execute before each test is run + @BeforeMethod + public void before() { + log.error("\n\n\n *** FIDO2 Plugin propertiesMap.get(fido2Url):{} {}", propertiesMap.get("fido2Url"), "\n\n\n"); + boolean isAvailable = isEndpointAvailable(propertiesMap.get("fido2Url"), accessToken); + log.error("\n\n\n *** FIDO2 Plugin isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("FIDO2 Plugin Not deployed"); + }else { + log.info("\n\n\n *** FIDO2 Plugin is Deployed {}", "\n\n"); + } + } + +} diff --git a/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/test/Fido2ResourceTest.java b/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/test/Fido2ResourceTest.java new file mode 100644 index 00000000000..b03613128d4 --- /dev/null +++ b/jans-config-api/plugins/fido2-plugin/src/test/java/io/jans/configapi/plugin/fido2/test/Fido2ResourceTest.java @@ -0,0 +1,36 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.fido2.test; + +import io.jans.configapi.plugin.fido2.Fido2BaseTest; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Parameters; + +public class Fido2ResourceTest extends Fido2BaseTest { + + @Parameters({ "test.issuer", "fido2Url" }) + @Test + public void getFido2Configuration(final String issuer, final String fido2Url) { + log.error("\n\n getFido2Configuration() - accessToken:{}, issuer:{}, fido2Url:{}", accessToken, issuer, fido2Url); + + Builder request = getResteasyService().getClientBuilder(issuer + fido2Url); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("getFido2Configuration() - Response for getDefaultAuthenticationMethod - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + +} diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/dynamiconf.json b/jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/dynamiconf.json similarity index 100% rename from jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/dynamiconf.json rename to jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/dynamiconf.json diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/fido2.feature b/jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/fido2.feature similarity index 100% rename from jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/fido2.feature rename to jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/fido2.feature diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/fido2.json b/jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/fido2.json similarity index 100% rename from jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/fido2.json rename to jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/fido2.json diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/ref_dynami_conf.json b/jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/ref_dynami_conf.json similarity index 100% rename from jans-config-api/plugins/fido2-plugin/src/test/resources/feature/fido2/ref_dynami_conf.json rename to jans-config-api/plugins/fido2-plugin/src/test/resources/json/fido2/ref_dynami_conf.json diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index 35a4a9bb3c1..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - fido2Url: baseUrl + '/jans-config-api/fido2/fido2-config', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config.js deleted file mode 100644 index 0a39c646bec..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,57 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - fido2Url: baseUrl + '/jans-config-api/fido2/fido2-config', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/fido2-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/fido2-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/test.properties b/jans-config-api/plugins/fido2-plugin/src/test/resources/test.properties index 4257f297907..66af8d40572 100644 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/fido2-plugin/src/test/resources/test.properties @@ -5,4 +5,15 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete + +# Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + +fido2Url=/jans-config-api/fido2/fido2-config \ No newline at end of file diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/fido2-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/fido2-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..9a5988a391d --- /dev/null +++ b/jans-config-api/plugins/fido2-plugin/src/test/resources/testng.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/fido2-plugin/src/test/resources/token.feature b/jans-config-api/plugins/fido2-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/fido2-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/plugins/jans-link-plugin/pom.xml b/jans-config-api/plugins/jans-link-plugin/pom.xml index 1b65f2ded34..427e7cba166 100644 --- a/jans-config-api/plugins/jans-link-plugin/pom.xml +++ b/jans-config-api/plugins/jans-link-plugin/pom.xml @@ -84,35 +84,15 @@ + + io.rest-assured + rest-assured + test + - io.rest-assured - rest-assured - test - - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -134,12 +114,6 @@ src/test/resources true - - karate.properties - karate_jenkins.properties - test.properties - *.* - @@ -177,29 +151,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java b/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java deleted file mode 100644 index a7f7d2d80c2..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class TestJenkinsRunner { - - @Test - void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/LinkBaseTest.java b/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/LinkBaseTest.java new file mode 100644 index 00000000000..491592f4714 --- /dev/null +++ b/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/LinkBaseTest.java @@ -0,0 +1,31 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.link; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class LinkBaseTest extends BaseTest { + + @BeforeMethod + public void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("linkConfigUrl"), accessToken); + log.error("\n\n\n *** JANS-LINK Plugin isAvailable:{} {}", isAvailable,"\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("JANS-LINK Plugin Not deployed"); + }else { + log.info("\n\n\n *** JANS-LINK Plugin is Deployed {}", "\n\n"); + } + } + +} diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/test/JansLinkConfigResourceTest.java b/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/test/JansLinkConfigResourceTest.java new file mode 100644 index 00000000000..08ef7032ddc --- /dev/null +++ b/jans-config-api/plugins/jans-link-plugin/src/test/java/io/jans/configapi/plugin/link/test/JansLinkConfigResourceTest.java @@ -0,0 +1,38 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.link.test; + +import io.jans.configapi.plugin.link.LinkBaseTest; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import org.testng.annotations.Parameters; + +public class JansLinkConfigResourceTest extends LinkBaseTest { + + @Parameters({ "test.issuer", "linkConfigUrl" }) + @Test + public void fetchLinkConfiguration(final String issuer, final String linkConfigUrl) { + log.info("fetchLinkConfiguration() - accessToken:{}, issuer:{}, linkConfigUrl:{}", accessToken, issuer, + linkConfigUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + linkConfigUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + log.info("Response for fetchLinkConfiguration - response:{}, response.getStatus()", response, response.getStatus()); + + } + +} diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/feature/link/dynamiconf.json b/jans-config-api/plugins/jans-link-plugin/src/test/resources/json/link/dynamiconf.json similarity index 100% rename from jans-config-api/plugins/jans-link-plugin/src/test/resources/feature/link/dynamiconf.json rename to jans-config-api/plugins/jans-link-plugin/src/test/resources/json/link/dynamiconf.json diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/feature/link/link-config.feature b/jans-config-api/plugins/jans-link-plugin/src/test/resources/json/link/link-config.feature similarity index 100% rename from jans-config-api/plugins/jans-link-plugin/src/test/resources/feature/link/link-config.feature rename to jans-config-api/plugins/jans-link-plugin/src/test/resources/json/link/link-config.feature diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index e8db40cc61c..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - jansLinkUrl: baseUrl + '/jans-config-api/jans-link/link-config', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config.js deleted file mode 100644 index 079922e6552..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,57 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - jansLinkUrl: baseUrl + '/jans-config-api/jans-link/link-config', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/test.properties b/jans-config-api/plugins/jans-link-plugin/src/test/resources/test.properties index 4257f297907..390c41391a7 100644 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/jans-link-plugin/src/test/resources/test.properties @@ -5,4 +5,16 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# +## Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + + +linkConfigUrl=/jans-config-api/jans-link/link-config \ No newline at end of file diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/jans-link-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/jans-link-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..73b9cdf7518 --- /dev/null +++ b/jans-config-api/plugins/jans-link-plugin/src/test/resources/testng.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/jans-link-plugin/src/test/resources/token.feature b/jans-config-api/plugins/jans-link-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/jans-link-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/plugins/kc-link-plugin/pom.xml b/jans-config-api/plugins/kc-link-plugin/pom.xml index d92ec7aeba1..08e827e78e7 100644 --- a/jans-config-api/plugins/kc-link-plugin/pom.xml +++ b/jans-config-api/plugins/kc-link-plugin/pom.xml @@ -122,35 +122,15 @@ + + io.rest-assured + rest-assured + test + - io.rest-assured - rest-assured - test - - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -173,12 +153,6 @@ src/test/resources true - - karate.properties - karate_jenkins.properties - test.properties - *.* - @@ -216,29 +190,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java b/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java deleted file mode 100644 index a7f7d2d80c2..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class TestJenkinsRunner { - - @Test - void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/KcLinkBaseTest.java b/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/KcLinkBaseTest.java new file mode 100644 index 00000000000..22bbb1e7661 --- /dev/null +++ b/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/KcLinkBaseTest.java @@ -0,0 +1,32 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.kc.link; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class KcLinkBaseTest extends BaseTest { + + // Execute before each test is run + @BeforeMethod + public void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("kcLinkConfigUrl"), accessToken); + log.error("\n\n\n *** KC-LINK - isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("KC-LINK Plugin not deployed"); + }else { + log.info("\n\n\n *** KC-LINK Plugin is Deployed {}", "\n\n"); + } + } + +} diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/test/JansKcLinkConfigResourceTest.java b/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/test/JansKcLinkConfigResourceTest.java new file mode 100644 index 00000000000..add664fe680 --- /dev/null +++ b/jans-config-api/plugins/kc-link-plugin/src/test/java/io/jans/configapi/plugin/kc/link/test/JansKcLinkConfigResourceTest.java @@ -0,0 +1,36 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.kc.link.test; + +import io.jans.configapi.plugin.kc.link.KcLinkBaseTest; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Parameters; + +public class JansKcLinkConfigResourceTest extends KcLinkBaseTest { + + @Parameters({ "test.issuer", "kcLinkConfigUrl" }) + @Test + public void getKcLinkConfiguration(final String issuer, final String kcLinkConfigUrl) { + log.info("getKcLinkConfiguration() - accessToken:{}, issuer:{}, kcLinkConfigUrl:{}", accessToken, issuer, + kcLinkConfigUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + kcLinkConfigUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getKcLinkConfiguration - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/feature/kc-link/kc-link-config.feature b/jans-config-api/plugins/kc-link-plugin/src/test/resources/json/kc-link/kc-link-config.feature similarity index 100% rename from jans-config-api/plugins/kc-link-plugin/src/test/resources/feature/kc-link/kc-link-config.feature rename to jans-config-api/plugins/kc-link-plugin/src/test/resources/json/kc-link/kc-link-config.feature diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index f17ade676db..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - kcLinkUrl: baseUrl + '/jans-config-api/kc-link/kc-link-config', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config.js deleted file mode 100644 index 41958588071..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,57 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - kcLinkUrl: baseUrl + '/jans-config-api/kc-link/kc-link-config', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/test.properties b/jans-config-api/plugins/kc-link-plugin/src/test/resources/test.properties index 4257f297907..1acc673afea 100644 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/kc-link-plugin/src/test/resources/test.properties @@ -5,4 +5,15 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# +## Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + +kcLinkConfigUrl=/jans-config-api/kc-link/kcLinkConfig \ No newline at end of file diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/kc-link-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/kc-link-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..94c7776d0bf --- /dev/null +++ b/jans-config-api/plugins/kc-link-plugin/src/test/resources/testng.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/kc-link-plugin/src/test/resources/token.feature b/jans-config-api/plugins/kc-link-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/kc-link-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/plugins/kc-saml-plugin/pom.xml b/jans-config-api/plugins/kc-saml-plugin/pom.xml index 29feff15e1e..071a5a5e603 100644 --- a/jans-config-api/plugins/kc-saml-plugin/pom.xml +++ b/jans-config-api/plugins/kc-saml-plugin/pom.xml @@ -142,35 +142,15 @@ + + io.rest-assured + rest-assured + test + - io.rest-assured - rest-assured - test - - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -193,12 +173,6 @@ src/test/resources true - - karate.properties - karate_jenkins.properties - test.properties - *.* - @@ -236,29 +210,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java deleted file mode 100644 index a7f7d2d80c2..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class TestJenkinsRunner { - - @Test - void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/KcSAMLBaseTest.java b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/KcSAMLBaseTest.java new file mode 100644 index 00000000000..eed645009b8 --- /dev/null +++ b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/KcSAMLBaseTest.java @@ -0,0 +1,32 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.saml; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class KcSAMLBaseTest extends BaseTest { + + // Execute before each test is run + @BeforeMethod + public void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("samlConfigUrl"), accessToken); + log.info("\n\n\n *** KC-SAML Plugin isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("KC-SAML Plugin not deployed"); + }else { + log.info("\n\n\n *** KC-SAML Plugin is Deployed{}", "\n\n"); + } + } + +} diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansIdpResourceTest.java b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansIdpResourceTest.java new file mode 100644 index 00000000000..3f7a032e3ff --- /dev/null +++ b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansIdpResourceTest.java @@ -0,0 +1,36 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.saml.test; + +import io.jans.configapi.plugin.saml.KcSAMLBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Parameters; + +public class JansIdpResourceTest extends KcSAMLBaseTest { + + @Parameters({ "test.issuer", "samlIdpUrl" }) + @Test + public void getKcSAMLIdp(final String issuer, final String samlIdpUrl) { + log.info("getKcSAMLIdp() - accessToken:{}, issuer:{}, samlIdpUrl:{}", accessToken, issuer, samlIdpUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + samlIdpUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getKcSAMLIdp - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLConfigResourceTest.java b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLConfigResourceTest.java new file mode 100644 index 00000000000..17f2a27e839 --- /dev/null +++ b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLConfigResourceTest.java @@ -0,0 +1,37 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.saml.test; + +import io.jans.configapi.plugin.saml.KcSAMLBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Parameters; + +public class JansKcSAMLConfigResourceTest extends KcSAMLBaseTest { + + @Parameters({ "test.issuer", "samlConfigUrl" }) + @Test + public void getKcSAMLConfiguration(final String issuer, final String samlConfigUrl) { + log.info("getKcSAMLConfiguration() - accessToken:{}, issuer:{}, samlConfigUrl:{}", accessToken, issuer, + samlConfigUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + samlConfigUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getKcSAMLConfiguration - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLTrustRelationshipTest.java b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLTrustRelationshipTest.java new file mode 100644 index 00000000000..598927feae3 --- /dev/null +++ b/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/plugin/saml/test/JansKcSAMLTrustRelationshipTest.java @@ -0,0 +1,37 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.saml.test; + +import io.jans.configapi.plugin.saml.KcSAMLBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; +import org.testng.annotations.Parameters; + +public class JansKcSAMLTrustRelationshipTest extends KcSAMLBaseTest { + + @Parameters({ "test.issuer", "samlTrustRelationshipUrl" }) + @Test + public void getKcSAMLTrustRelationship(final String issuer, final String samlTrustRelationshipUrl) { + log.info("getKcSAMLTrustRelationship() - accessToken:{}, issuer:{}, samlTrustRelationshipUrl:{}", accessToken, + issuer, samlTrustRelationshipUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + samlTrustRelationshipUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getKcSAMLTrustRelationship - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/feature/saml/config/saml.feature b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/json/saml/config/saml.feature similarity index 100% rename from jans-config-api/plugins/kc-saml-plugin/src/test/resources/feature/saml/config/saml.feature rename to jans-config-api/plugins/kc-saml-plugin/src/test/resources/json/saml/config/saml.feature diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/feature/saml/trust-relationship/saml-trust-relationship.feature b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/json/saml/trust-relationship/saml-trust-relationship.feature similarity index 100% rename from jans-config-api/plugins/kc-saml-plugin/src/test/resources/feature/saml/trust-relationship/saml-trust-relationship.feature rename to jans-config-api/plugins/kc-saml-plugin/src/test/resources/json/saml/trust-relationship/saml-trust-relationship.feature diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index d32b307b93f..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,59 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - samlTrustRelationshipUrl: baseUrl + '/jans-config-api/saml/trust-relationship', - samlConfigUrl: baseUrl + '/jans-config-api/saml/samlConfig', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config.js deleted file mode 100644 index a8086c01326..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - samlTrustRelationshipUrl: baseUrl + '/jans-config-api/saml/trust-relationship', - samlConfigUrl: baseUrl + '/jans-config-api/saml/samlConfig', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/test.properties b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/test.properties index 4257f297907..a27ab6fce4d 100644 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/test.properties @@ -5,4 +5,18 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# +## Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + +samlConfigUrl=/jans-config-api/kc/samlConfig +samlTrustRelationshipUrl=/jans-config-api/kc/saml/trust-relationship +samlIdpUrl=/jans-config-api/kc/saml/idp \ No newline at end of file diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..5236e3f6c52 --- /dev/null +++ b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/testng.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/token.feature b/jans-config-api/plugins/kc-saml-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/plugins/lock-plugin/pom.xml b/jans-config-api/plugins/lock-plugin/pom.xml index cace2d322a5..4093c7bdfea 100644 --- a/jans-config-api/plugins/lock-plugin/pom.xml +++ b/jans-config-api/plugins/lock-plugin/pom.xml @@ -111,35 +111,15 @@ + + io.rest-assured + rest-assured + test + - io.rest-assured - rest-assured - test - - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -162,12 +142,6 @@ src/test/resources true - - karate.properties - karate_jenkins.properties - test.properties - *.* - @@ -205,29 +179,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java deleted file mode 100644 index a7f7d2d80c2..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/TestJenkinsRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class TestJenkinsRunner { - - @Test - void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/LockBaseTest.java b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/LockBaseTest.java new file mode 100644 index 00000000000..432e5ac99eb --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/LockBaseTest.java @@ -0,0 +1,32 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.lock; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class LockBaseTest extends BaseTest { + + // Execute before each test is run + @BeforeMethod + public void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("lockConfigUrl"), accessToken); + log.error("\n\n\n *** LOCK Plugin isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("LOCK Plugin not deployed"); + }else { + log.info("\n\n\n *** LOCK Plugin is Deployed {}", "\n\n"); + } + } + +} diff --git a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockAuditResourceTest.java b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockAuditResourceTest.java new file mode 100644 index 00000000000..227410e08b1 --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockAuditResourceTest.java @@ -0,0 +1,54 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.lock.test; + +import io.jans.configapi.plugin.lock.LockBaseTest; + +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; +import org.testng.annotations.Parameters; + +public class LockAuditResourceTest extends LockBaseTest { + + @Parameters({ "test.issuer", "lockAuditHealthPostUrl", "audit_health_post_1" }) + @Test + public void getLockAuditData(final String issuer, final String lockAuditHealthPostUrl, final String json) { + log.info("getLockAuditData() - accessToken:{}, issuer:{}, lockAuditHealthPostUrl:{}, json:{}", accessToken, + issuer, lockAuditHealthPostUrl, json); + + Builder request = getResteasyService().getClientBuilder(issuer + lockAuditHealthPostUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.post(Entity.entity(json, MediaType.APPLICATION_JSON)); + log.info("post lock audit - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + + @Parameters({ "test.issuer", "lockAuditHealthSearchUrl" }) + // @Test + public void getLockAuditData(final String issuer, final String lockAuditHealthSearchUrl) { + log.info("getLockAuditData() - accessToken:{}, issuer:{}, lockAuditHealthSearchUrl:{}", accessToken, issuer, + lockAuditHealthSearchUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + lockAuditHealthSearchUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getLockAuditData - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockConfigResourceTest.java b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockConfigResourceTest.java new file mode 100644 index 00000000000..f5193bfb128 --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/java/io/jans/configapi/plugin/lock/test/LockConfigResourceTest.java @@ -0,0 +1,37 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.lock.test; + +import io.jans.configapi.plugin.lock.LockBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; +import org.testng.annotations.Parameters; + +public class LockConfigResourceTest extends LockBaseTest { + + @Parameters({ "test.issuer", "lockConfigUrl" }) + @Test + public void getLockConfigUrlData(final String issuer, final String lockConfigUrl) { + log.info("getLockConfigUrlData() - accessToken:{}, issuer:{}, lockConfigUrl:{}", accessToken, issuer, + lockConfigUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + lockConfigUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getLockConfigUrlData - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-health-post.json b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-health-post.json new file mode 100644 index 00000000000..763018756bf --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-health-post.json @@ -0,0 +1,6 @@ +{ + "jansStatus": "Success", + "cedarEngineStatus": "fail", + "cedarPolicyStatus": "pass", + "tokenDataStatus": "error" +} \ No newline at end of file diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-log-post.json b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-log-post.json new file mode 100644 index 00000000000..65c11f6e7c7 --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-log-post.json @@ -0,0 +1,9 @@ +{ + "eventTime": "2012-04-21T18:25:43-05:00", + "eventType": "registration", + "severetyLevel": "warning", + "policyId": "PID001", + "policyResult": "deny", + "userAccountId": "ACC0001", + "clientId": "CLI001" +} \ No newline at end of file diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-telemetry-post.json b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-telemetry-post.json new file mode 100644 index 00000000000..e20b63821e9 --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-audit-telemetry-post.json @@ -0,0 +1,15 @@ +{ + "lastPolicyLoadTime": "2012-04-21T18:25:43-05:00", + "lastPolicyLoadSize": 1, + "status": "Success", + "policySuccessLoadCounter": 2, + "policyFailedLoadCounter": 0, + "lastPolicyEvaluationTimeNs": 5, + "avgPolicyEvaluationTimeNs": 3, + "evaluationRequestsCount": 2, + "memoryusage": "2200", + "policyRequestData": { + "aname": "puja", + "gender": "femmale" + } +} \ No newline at end of file diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/feature/lock/lock-config.feature b/jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-config.feature similarity index 100% rename from jans-config-api/plugins/lock-plugin/src/test/resources/feature/lock/lock-config.feature rename to jans-config-api/plugins/lock-plugin/src/test/resources/json/lock/lock-config.feature diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/lock-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index 6689c423102..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - lockUrl: baseUrl + '/jans-config-api/lock/lock-config', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/lock-plugin/src/test/resources/karate-config.js deleted file mode 100644 index eed01e27f05..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,57 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - LockUrl: baseUrl + '/jans-config-api/lock/lock-config', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/lock-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/lock-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/test.properties b/jans-config-api/plugins/lock-plugin/src/test/resources/test.properties index 4257f297907..794babb75e7 100644 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/lock-plugin/src/test/resources/test.properties @@ -5,4 +5,26 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# +## Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + +lockAuditHealthPostUrl=/jans-config-api/lock/audit/health +lockAuditHealthSearchUrl=/jans-config-api/lock/audit/health/search +lockAuditLogPostUrl=/jans-config-api/lock/audit/log +lockAuditLogSearchUrl=/jans-config-api/lock/audit/log/search +lockAuditTelemetryPostUrl=/jans-config-api/lock/audit/telemetry +lockAuditTelemetrySearchUrl=/jans-config-api/lock/audit/telemetry/search +lockConfigUrl=/jans-config-api/lock/lockConfig + + +audit_health_post_1=file:target/test-classes/json/lock/lock-audit-health-post.json +audit_log_post_1=file:target/test-classes/json/lock/lock-audit-log-post.json +audit_telemetry_post_1=file:target/test-classes/json/lock/lock-audit-telemetry-post.json diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/lock-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/lock-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..022adf2f03b --- /dev/null +++ b/jans-config-api/plugins/lock-plugin/src/test/resources/testng.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/lock-plugin/src/test/resources/token.feature b/jans-config-api/plugins/lock-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/lock-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/plugins/scim-plugin/pom.xml b/jans-config-api/plugins/scim-plugin/pom.xml index 7d460c68a29..1a1309ab79d 100644 --- a/jans-config-api/plugins/scim-plugin/pom.xml +++ b/jans-config-api/plugins/scim-plugin/pom.xml @@ -86,35 +86,15 @@ + + io.rest-assured + rest-assured + test + - io.rest-assured - rest-assured - test - - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -136,12 +116,6 @@ src/test/resources true - - karate.properties - karate_jenkins.properties - test.properties - *.* - @@ -179,29 +153,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java b/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java deleted file mode 100644 index d039e1f2040..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Yuriy Zabrovarnyy - */ -public class JenkinsTestRunner { - - @Test - public void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/ScimBaseTest.java b/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/ScimBaseTest.java new file mode 100644 index 00000000000..4ad647b415b --- /dev/null +++ b/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/ScimBaseTest.java @@ -0,0 +1,36 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.scim; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class ScimBaseTest extends BaseTest { + + protected boolean isAvailable(final String url, Map headers, final Map parameters) { + return isEndpointAvailable(url, headers, parameters); + } + + // Execute before each test is run + @BeforeMethod + public void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("scimConfigUrl"), accessToken); + log.info("\n\n\n *** SCIM Plugin isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("SCIM Plugin not deployed"); + }else { + log.info("\n\n\n *** SCIM Plugin is Deployed {}", "\n\n"); + } + } + +} diff --git a/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/test/ScimConfigResourceTest.java b/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/test/ScimConfigResourceTest.java new file mode 100644 index 00000000000..6f0602a2b30 --- /dev/null +++ b/jans-config-api/plugins/scim-plugin/src/test/java/io/jans/configapi/plugin/scim/test/ScimConfigResourceTest.java @@ -0,0 +1,37 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.scim.test; + +import io.jans.configapi.plugin.scim.ScimBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; +import org.testng.annotations.Parameters; + +public class ScimConfigResourceTest extends ScimBaseTest { + + @Parameters({ "test.issuer", "scimConfigUrl" }) + @Test + public void getScimConfigData(final String issuer, final String scimConfigUrl) { + log.info("getScimConfigData() - accessToken:{}, issuer:{}, scimConfigUrl:{}", accessToken, issuer, + scimConfigUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + scimConfigUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getScimConfigData - response:{}", response); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/feature/scim/config/scim-config.feature b/jans-config-api/plugins/scim-plugin/src/test/resources/json/scim/config/scim-config.feature similarity index 100% rename from jans-config-api/plugins/scim-plugin/src/test/resources/feature/scim/config/scim-config.feature rename to jans-config-api/plugins/scim-plugin/src/test/resources/json/scim/config/scim-config.feature 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 deleted file mode 100644 index fd5214c5cfe..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - //scim - scim_config_url: baseUrl + '/jans-config-api/scim/scim-config', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file 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 deleted file mode 100644 index 0c8ff9e7111..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,59 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - - //scim - scim_config_url: baseUrl + '/jans-config-api/scim/scim-config', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/scim-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/scim-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/test.properties b/jans-config-api/plugins/scim-plugin/src/test/resources/test.properties index 4257f297907..97f395801ac 100644 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/scim-plugin/src/test/resources/test.properties @@ -5,4 +5,17 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# +## Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + + +scimConfigUrl=/jans-config-api/scim/scim-config \ No newline at end of file diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/scim-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/scim-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..d070b6ce086 --- /dev/null +++ b/jans-config-api/plugins/scim-plugin/src/test/resources/testng.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/scim-plugin/src/test/resources/token.feature b/jans-config-api/plugins/scim-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/scim-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/plugins/user-mgt-plugin/pom.xml b/jans-config-api/plugins/user-mgt-plugin/pom.xml index 27c77ea328b..76fe2b2b3ec 100644 --- a/jans-config-api/plugins/user-mgt-plugin/pom.xml +++ b/jans-config-api/plugins/user-mgt-plugin/pom.xml @@ -82,35 +82,15 @@ + + io.rest-assured + rest-assured + test + - io.rest-assured - rest-assured - test - - - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -132,12 +112,6 @@ src/test/resources true - - karate.properties - karate_jenkins.properties - test.properties - *.* - @@ -175,29 +149,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java b/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java deleted file mode 100644 index d039e1f2040..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/JenkinsTestRunner.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Yuriy Zabrovarnyy - */ -public class JenkinsTestRunner { - - @Test - public void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/UserBaseTest.java b/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/UserBaseTest.java new file mode 100644 index 00000000000..2a8ee9dc20f --- /dev/null +++ b/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/UserBaseTest.java @@ -0,0 +1,31 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.mgt; + +import io.jans.configapi.core.test.BaseTest; + +import java.util.Map; + +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; + +public class UserBaseTest extends BaseTest { + + // Execute before each test is run + @BeforeMethod + public void before() { + boolean isAvailable = isEndpointAvailable(propertiesMap.get("userUrl"), accessToken); + log.error("\n\n\n ******************** USER-MGT Plugin isAvailable:{} {}", isAvailable, "\n\n\n"); + // check condition, note once you condition is met the rest of the tests will be + // skipped as well + if (!isAvailable) { + throw new SkipException("USER-MGT Plugin not deployed"); + }else { + log.info("\n\n\n *** USER-MGT Plugin is Deployed {}", "\n\n"); + } + } +} diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/test/UserResourceTest.java b/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/test/UserResourceTest.java new file mode 100644 index 00000000000..6bd39ac38da --- /dev/null +++ b/jans-config-api/plugins/user-mgt-plugin/src/test/java/io/jans/configapi/plugin/mgt/test/UserResourceTest.java @@ -0,0 +1,37 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.plugin.mgt.test; + +import io.jans.configapi.plugin.mgt.UserBaseTest; + +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; +import org.testng.annotations.Parameters; +import static org.testng.Assert.assertEquals; + +public class UserResourceTest extends UserBaseTest { + + @Parameters({ "test.issuer", "userUrl" }) + @Test + public void getUserResourceData(final String issuer, final String userUrl) { + log.info("\n\n getUserResourceData() - accessToken:{}, issuer:{}, userUrl:{}", accessToken, issuer, userUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + userUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("\n\n Response for getUserResourceData() - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + +} diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user-patch.json b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user-patch.json similarity index 100% rename from jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user-patch.json rename to jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user-patch.json diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user-ref.json b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user-ref.json similarity index 100% rename from jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user-ref.json rename to jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user-ref.json diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user.feature b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user.feature similarity index 100% rename from jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user.feature rename to jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user.feature diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user.json b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user.json similarity index 100% rename from jans-config-api/plugins/user-mgt-plugin/src/test/resources/feature/mgt/user/user.json rename to jans-config-api/plugins/user-mgt-plugin/src/test/resources/json/mgt/user/user.json diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config-jenkins.js b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index bffd51af405..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,58 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - //mgt - user_url: baseUrl + '/jans-config-api/mgt/configuser', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config.js b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config.js deleted file mode 100644 index ac0472c4dd1..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate-config.js +++ /dev/null @@ -1,59 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - - //mgt - user_url: baseUrl + '/jans-config-api/mgt/configuser', - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate.properties b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate_jenkins.properties b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/test.properties b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/test.properties index 4257f297907..9e4043c2b74 100644 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/test.properties +++ b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/test.properties @@ -5,4 +5,15 @@ token.endpoint=${token.endpoint} token.grant.type=${token.grant.type} test.client.id=${test.client.id} test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +test.issuer=${test.issuer} + +#test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# +## Test env Setting +#token.endpoint=https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/token +#token.grant.type=client_credentials +#test.client.id=1800.661fe525-107d-4747-b49b-8c67b1ada3b4 +#test.client.secret=9UZigIRGKXR9 +#test.issuer=https://pujavs-light-gobbler.gluu.info + +userUrl=/jans-config-api/mgt/configuser \ No newline at end of file diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/testClient.feature b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/testng.xml b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/testng.xml new file mode 100644 index 00000000000..4c81712a52b --- /dev/null +++ b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/testng.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/token.feature b/jans-config-api/plugins/user-mgt-plugin/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/plugins/user-mgt-plugin/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/pom.xml b/jans-config-api/pom.xml index efb8f25fd64..9278f980ed7 100644 --- a/jans-config-api/pom.xml +++ b/jans-config-api/pom.xml @@ -23,7 +23,7 @@ 11 UTF-8 UTF-8 - 3.0.0-M5 + 3.5.2 ${project.version} @@ -41,7 +41,7 @@ 4.7.5.Final 5.0.1 - 0.9.5 + 7.8.0 2.0 5.7.0 3.8.0 @@ -93,11 +93,7 @@ Bouncy Castle https://repo1.maven.org/maven2/org/bouncycastle - - repository.jboss.org - JBoss Repository - https://repository.jboss.org/nexus/content/groups/public-jboss/ - + @@ -109,13 +105,13 @@ - - io.jans - jans-bom - ${jans.version} - import - pom - + + io.jans + jans-bom + ${jans.version} + import + pom + com.fasterxml.jackson jackson-bom @@ -333,40 +329,12 @@ test - com.intuit.karate - karate-junit5 - ${karate.version} - test - - - snakeyaml - * - - - - - com.intuit.karate - karate-apache - ${karate.version} - test - - - org.yaml - snakeyaml - ${snake.version} - - - org.junit.jupiter - junit-jupiter-api - ${jupiter.version} - test - - - org.junit.jupiter - junit-jupiter-engine - ${jupiter.version} - test - + org.testng + testng + ${testng.version} + + + net.masterthought cucumber-reporting diff --git a/jans-config-api/server/pom.xml b/jans-config-api/server/pom.xml index b0d052e9f61..cb7fa2828a8 100644 --- a/jans-config-api/server/pom.xml +++ b/jans-config-api/server/pom.xml @@ -195,29 +195,9 @@ test - com.intuit.karate - karate-junit5 - test - - - com.intuit.karate - karate-apache - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - net.masterthought - cucumber-reporting - test + org.testng + testng + test @@ -266,22 +246,15 @@ jans-config-api - ../profiles/${cfg}/config-build.properties ../profiles/${cfg}/config-api-test.properties - - - src/test/resources - true - - karate.properties - karate_jenkins.properties - test.properties - *.* - - - + + + src/test/resources + true + + @@ -386,29 +359,13 @@ + org.apache.maven.plugins maven-surefire-plugin - - - integration - - --tags ~@ignore - + + target/test-classes/testng.xml + - - - integration-tests - integration-test - - test - - - false - !integration - integration - - - diff --git a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/server/src/test/java/io/jans/configapi/ConfigServerBaseTest.java similarity index 51% rename from jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java rename to jans-config-api/server/src/test/java/io/jans/configapi/ConfigServerBaseTest.java index 34da4586ef9..e487705f1dc 100644 --- a/jans-config-api/plugins/kc-saml-plugin/src/test/java/io/jans/configapi/KarateTestRunner.java +++ b/jans-config-api/server/src/test/java/io/jans/configapi/ConfigServerBaseTest.java @@ -6,13 +6,10 @@ package io.jans.configapi; -import com.intuit.karate.junit5.Karate; -public class KarateTestRunner { +import io.jans.configapi.core.test.BaseTest; - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } +public class ConfigServerBaseTest extends BaseTest{ + //server specific code } diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/JenkinsTestRunner.java b/jans-config-api/server/src/test/java/io/jans/configapi/JenkinsTestRunner.java deleted file mode 100644 index d039e1f2040..00000000000 --- a/jans-config-api/server/src/test/java/io/jans/configapi/JenkinsTestRunner.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.Results; -import com.intuit.karate.Runner; - -import io.jans.as.common.model.registration.Client; -import net.masterthought.cucumber.Configuration; -import net.masterthought.cucumber.ReportBuilder; -import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Yuriy Zabrovarnyy - */ -public class JenkinsTestRunner { - - @Test - public void testParallel() { - System.setProperty("karate.env", "jenkins"); - Results results = Runner.path("src/test/resources/feature").tags("~@ignore").parallel(1); - generateReport(results.getReportDir()); - Assertions.assertEquals(0, results.getFailCount(), results.getErrorMessages()); - } - - public static void generateReport(String karateOutputPath) { - Collection jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] { "json" }, true); - List jsonPaths = new ArrayList(jsonFiles.size()); - jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath())); - Configuration config = new Configuration(new File("target"), "karateTesting"); - ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config); - reportBuilder.generateReports(); - } -} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/KarateTestRunner.java b/jans-config-api/server/src/test/java/io/jans/configapi/KarateTestRunner.java deleted file mode 100644 index 34da4586ef9..00000000000 --- a/jans-config-api/server/src/test/java/io/jans/configapi/KarateTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi; - -import com.intuit.karate.junit5.Karate; - -public class KarateTestRunner { - - @Karate.Test - Karate testFullPath() throws Exception { - return Karate.run("src/test/resources/feature"); - } - -} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/rest/resource/ConfigResourceTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/rest/resource/ConfigResourceTest.java deleted file mode 100644 index 34e4b478b39..00000000000 --- a/jans-config-api/server/src/test/java/io/jans/configapi/rest/resource/ConfigResourceTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. - * - * Copyright (c) 2020, Janssen Project - */ - -package io.jans.configapi.rest.resource; - -import org.junit.jupiter.api.Test; -import jakarta.ws.rs.core.MediaType; -import static io.restassured.RestAssured.given; - -/** - * @author Yuriy Zabrovarnyy - */ -public class ConfigResourceTest { - - @Test - public void patchAppConfigurationProperty() { - given().when().contentType(MediaType.APPLICATION_JSON) - .header("Authorization", "Bearer 0ea2ce99-b741-4f5a-8fd7-26f52d057c19", null) - .body("[ {\"op\":\"replace\", \"path\": \"/loggingLevel\", \"value\": \"DEBUG\" } ]") - .patch("/jans-config-api/api/v1/jans-auth-server/config").then().statusCode(200); - } -} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AcrsResourceTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AcrsResourceTest.java new file mode 100644 index 00000000000..e7228233572 --- /dev/null +++ b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AcrsResourceTest.java @@ -0,0 +1,55 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.test.auth; + +import io.jans.configapi.ConfigServerBaseTest; + +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class AcrsResourceTest extends ConfigServerBaseTest { + + private String defaultAcr; + + @Parameters({ "test.issuer", "acrsUrl" }) + @Test + public void getDefaultAuthenticationMethod(final String issuer, final String acrsUrl) { + log.info("accessToken:{}, issuer:{}, acrsUrl:{}", accessToken, issuer, acrsUrl); + Builder request = getResteasyService().getClientBuilder(issuer + acrsUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + Response response = request.get(); + log.info("response:{}", response); + defaultAcr = response.readEntity(String.class); + log.info("Response for getDefaultAuthenticationMethod - defaultAcr:{}, response.getStatus():{}", defaultAcr, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + @Parameters({ "test.issuer", "acrsUrl" }) + @Test + public void postClient(final String issuer, final String acrsUrl) { + log.info("accessToken:{}, issuer:{}, acrsUrl:{}", accessToken, issuer, acrsUrl); + Builder request = getResteasyService().getClientBuilder(issuer + acrsUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + log.info("Update defaultAcr:{}", defaultAcr); + Response response = request.put(Entity.entity(defaultAcr, MediaType.APPLICATION_JSON)); + log.info("Response for getApiConfigtion - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } +} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AgamaDeploymentsResourceTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AgamaDeploymentsResourceTest.java new file mode 100644 index 00000000000..e6a49b34d8e --- /dev/null +++ b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AgamaDeploymentsResourceTest.java @@ -0,0 +1,36 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.test.auth; + +import io.jans.configapi.ConfigServerBaseTest; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class AgamaDeploymentsResourceTest extends ConfigServerBaseTest { + + @Parameters({ "test.issuer", "agamaDeploymentUrl" }) + @Test + public void getDeployments(final String issuer, final String agamaDeploymentUrl) { + log.info("accessToken:{}, issuer:{}, agamaDeploymentUrl:{}", accessToken, issuer, agamaDeploymentUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + agamaDeploymentUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); + + Response response = request.get(); + log.info("Response for getDefaultAuthenticationMethod - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + +} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AuthConfigResourceTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AuthConfigResourceTest.java new file mode 100644 index 00000000000..134b238e70a --- /dev/null +++ b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/AuthConfigResourceTest.java @@ -0,0 +1,73 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.test.auth; + +import io.jans.configapi.ConfigServerBaseTest; + +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import static org.testng.Assert.*; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class AuthConfigResourceTest extends ConfigServerBaseTest { + + @Parameters({ "test.issuer", "authConfigurationUrl" }) + @Test + public void getAuthConfigurationProperty(final String issuer, final String authConfigurationUrl) { + log.info("getAuthConfigurationProperty() - accessToken:{}, issuer:{}, authConfigurationUrl:{}", accessToken, + issuer, authConfigurationUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + authConfigurationUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getAuthConfigurationProperty() - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + @Parameters({ "test.issuer", "authConfigurationUrl" }) + @Test + public void getPersistenceDetails(final String issuer, final String authConfigurationUrl) { + log.info("getPersistenceDetails() - accessToken:{}, issuer:{}, authConfigurationUrl:{}", accessToken, issuer, + authConfigurationUrl); + + Builder request = getResteasyService().getClientBuilder(issuer + authConfigurationUrl + "/persistence"); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getPersistenceDetails() - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + @Parameters({ "test.issuer", "authConfigurationUrl", "auth_config_patch_1" }) + @Test + public void patchAuthConfigurationProperty(final String issuer, final String authConfigurationUrl, + final String json) { + log.info( + "patchAuthConfigurationProperty() - getApiConfigtion() - accessToken:{}, issuer:{}, authConfigurationUrl:{}, json:{}", + accessToken, issuer, authConfigurationUrl, json); + Builder request = getResteasyService().getClientBuilder(issuer + authConfigurationUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON_PATCH_JSON); + + Response response = request.method(HttpMethod.PATCH, + Entity.entity(json, MediaType.APPLICATION_JSON_PATCH_JSON)); + log.info("Response patchAuthConfigurationProperty() - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } +} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ClientResourceTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ClientResourceTest.java new file mode 100644 index 00000000000..6abca36b110 --- /dev/null +++ b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ClientResourceTest.java @@ -0,0 +1,55 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.test.auth; + +import io.jans.configapi.ConfigServerBaseTest; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import static org.testng.Assert.*; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class ClientResourceTest extends ConfigServerBaseTest { + + @Parameters({ "test.issuer", "openidClientsUrl" }) + @Test + public void getAllClient(final String issuer, final String openidClientsUrl) { + log.info("getAllClient() - accessToken:{}, issuer:{}, openidClientsUrl:{}", accessToken, issuer, + openidClientsUrl); + Builder request = getResteasyService().getClientBuilder(issuer + openidClientsUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + Response response = request.get(); + log.info("Response for getAllClient - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + + @Parameters({ "test.issuer", "openidClientsUrl", "openid_client_1" }) + @Test + public void postClient(final String issuer, final String openidClientsUrl, final String json) { + log.info("\n\n\n postClient2 - accessToken:{}, issuer:{}, openidClientsUrl:{}, json:{}", accessToken, issuer, + openidClientsUrl, json); + + Builder request = getResteasyService().getClientBuilder(issuer + openidClientsUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); + Response response = request.post(Entity.entity(json, MediaType.APPLICATION_JSON)); + log.info("post client - response:{}, response.getStatus():{}", response, response.getStatus()); + + if (response.getStatus() == 201) { + log.trace("Response for postClient - response.getEntity():{}, response.getClass():{}", + response.getEntity(), response.getClass()); + } + + assertEquals(response.getStatus(), Status.CREATED.getStatusCode()); + } +} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ConfigResourceTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ConfigResourceTest.java new file mode 100644 index 00000000000..de503bf3977 --- /dev/null +++ b/jans-config-api/server/src/test/java/io/jans/configapi/test/auth/ConfigResourceTest.java @@ -0,0 +1,55 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.test.auth; + +import static org.testng.Assert.assertEquals; + +import io.jans.configapi.ConfigServerBaseTest; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; + +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +public class ConfigResourceTest extends ConfigServerBaseTest { + + @Parameters({ "test.issuer", "apiConfigtionUrl" }) + @Test + public void getApiConfigtion(final String issuer, final String apiConfigtionUrl) { + log.info("getApiConfigtion() - accessToken:{}, issuer:{}, apiConfigtionUrl:{}", accessToken, issuer, + apiConfigtionUrl); + Builder request = getResteasyService().getClientBuilder(issuer + apiConfigtionUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + Response response = request.get(); + log.info("Response for getApiConfigtion - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + + } + + @Parameters({ "test.issuer", "apiConfigtionUrl", "api_config_patch_1" }) + @Test + public void patchgetApiConfigtion(final String issuer, final String apiConfigtionUrl, final String json) { + log.info("getApiConfigtion() - accessToken:{}, issuer:{}, apiConfigtionUrl:{}, json:{}", accessToken, issuer, + apiConfigtionUrl, json); + Builder request = getResteasyService().getClientBuilder(issuer + apiConfigtionUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON_PATCH_JSON); + + Response response = request.method(HttpMethod.PATCH, + Entity.entity(json, MediaType.APPLICATION_JSON_PATCH_JSON)); + log.info("Response for patchgetApiConfigtion - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } +} diff --git a/jans-config-api/server/src/test/java/io/jans/configapi/test/health/ApiHealthTest.java b/jans-config-api/server/src/test/java/io/jans/configapi/test/health/ApiHealthTest.java new file mode 100644 index 00000000000..b1df4b01d3e --- /dev/null +++ b/jans-config-api/server/src/test/java/io/jans/configapi/test/health/ApiHealthTest.java @@ -0,0 +1,70 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.test.health; + +import io.jans.configapi.ConfigServerBaseTest; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Parameters; + +public class ApiHealthTest extends ConfigServerBaseTest { + + @Parameters({ "test.issuer", "healthUrl" }) + @Test + public void getAppHealth(final String issuer, final String healthUrl) { + log.info("accessToken:{}, issuer:{}, healthUrl:{}", accessToken, issuer, healthUrl); + Response response = getHealthResponse(issuer + healthUrl); + log.info("Response for getAppHealth - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + @Parameters({ "test.issuer", "healthUrl" }) + @Test + public void getServerStat(final String issuer, final String healthUrl) { + log.info("accessToken:{}, issuer:{}, healthUrl:{}", accessToken, issuer, healthUrl); + Response response = getHealthResponse(issuer + healthUrl + "/server-stat"); + log.info("Response for getServerStat - response:{}, response.getStatus():{}", response, response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + @Parameters({ "test.issuer", "healthUrl" }) + @Test + public void getApplicationVersion(final String issuer, final String healthUrl) { + log.info("accessToken:{}, issuer:{}, healthUrl:{}", accessToken, issuer, healthUrl); + Response response = getHealthResponse(issuer + healthUrl + "/app-version"); + log.info("Response for getApplicationVersion - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + @Parameters({ "test.issuer", "healthUrl" }) + @Test + public void getServiceStatus(final String issuer, final String healthUrl) { + log.info("accessToken:{}, issuer:{}, healthUrl:{}", accessToken, issuer, healthUrl); + Response response = getHealthResponse(issuer + healthUrl + "/service-status"); + log.info("Response for getServiceStatus - response:{}, response.getStatus():{}", response, + response.getStatus()); + assertEquals(response.getStatus(), Status.OK.getStatusCode()); + } + + private Response getHealthResponse(final String healthUrl) { + log.info("accessToken:{}, healthUrl:{}", accessToken, healthUrl); + + Builder request = getResteasyService().getClientBuilder(healthUrl); + request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken); + request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON); + + return request.get(); + } +} diff --git a/jans-config-api/server/src/test/resources/feature/agama/agama-deployment.feature b/jans-config-api/server/src/test/resources/json/agama/agama-deployment.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/agama/agama-deployment.feature rename to jans-config-api/server/src/test/resources/json/agama/agama-deployment.feature diff --git a/jans-config-api/server/src/test/resources/feature/agama/agama-source.txt b/jans-config-api/server/src/test/resources/json/agama/agama-source.txt similarity index 100% rename from jans-config-api/server/src/test/resources/feature/agama/agama-source.txt rename to jans-config-api/server/src/test/resources/json/agama/agama-source.txt diff --git a/jans-config-api/server/src/test/resources/feature/agama/agama.feature b/jans-config-api/server/src/test/resources/json/agama/agama.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/agama/agama.feature rename to jans-config-api/server/src/test/resources/json/agama/agama.feature diff --git a/jans-config-api/server/src/test/resources/feature/agama/agama.json b/jans-config-api/server/src/test/resources/json/agama/agama.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/agama/agama.json rename to jans-config-api/server/src/test/resources/json/agama/agama.json diff --git a/jans-config-api/server/src/test/resources/feature/agama/agama1.json b/jans-config-api/server/src/test/resources/json/agama/agama1.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/agama/agama1.json rename to jans-config-api/server/src/test/resources/json/agama/agama1.json diff --git a/jans-config-api/server/src/test/resources/feature/attribute/attribute-for-patch.json b/jans-config-api/server/src/test/resources/json/attribute/attribute-for-patch.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/attribute/attribute-for-patch.json rename to jans-config-api/server/src/test/resources/json/attribute/attribute-for-patch.json diff --git a/jans-config-api/server/src/test/resources/feature/attribute/attribute.json b/jans-config-api/server/src/test/resources/json/attribute/attribute.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/attribute/attribute.json rename to jans-config-api/server/src/test/resources/json/attribute/attribute.json diff --git a/jans-config-api/server/src/test/resources/feature/attribute/attributes.feature b/jans-config-api/server/src/test/resources/json/attribute/attributes.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/attribute/attributes.feature rename to jans-config-api/server/src/test/resources/json/attribute/attributes.feature diff --git a/jans-config-api/server/src/test/resources/feature/client-auth/client-auth.feature b/jans-config-api/server/src/test/resources/json/client-auth/client-auth.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/client-auth/client-auth.feature rename to jans-config-api/server/src/test/resources/json/client-auth/client-auth.feature diff --git a/jans-config-api/server/src/test/resources/json/config/api/api-config-patch.json b/jans-config-api/server/src/test/resources/json/config/api/api-config-patch.json new file mode 100644 index 00000000000..f77adb2e539 --- /dev/null +++ b/jans-config-api/server/src/test/resources/json/config/api/api-config-patch.json @@ -0,0 +1,5 @@ +[{ + "op": "replace", + "path": "/loggingLevel", + "value": "DEBUG" +}] \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/feature/config/api/properties.feature b/jans-config-api/server/src/test/resources/json/config/api/properties.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/api/properties.feature rename to jans-config-api/server/src/test/resources/json/config/api/properties.feature diff --git a/jans-config-api/server/src/test/resources/json/config/auth/auth-config-patch.json b/jans-config-api/server/src/test/resources/json/config/auth/auth-config-patch.json new file mode 100644 index 00000000000..f77adb2e539 --- /dev/null +++ b/jans-config-api/server/src/test/resources/json/config/auth/auth-config-patch.json @@ -0,0 +1,5 @@ +[{ + "op": "replace", + "path": "/loggingLevel", + "value": "DEBUG" +}] \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/feature/config/cache/cache.feature b/jans-config-api/server/src/test/resources/json/config/cache/cache.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/cache/cache.feature rename to jans-config-api/server/src/test/resources/json/config/cache/cache.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/database/ldap/get-ldap-config.feature b/jans-config-api/server/src/test/resources/json/config/database/ldap/get-ldap-config.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/database/ldap/get-ldap-config.feature rename to jans-config-api/server/src/test/resources/json/config/database/ldap/get-ldap-config.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/database/ldap/ldap.feature b/jans-config-api/server/src/test/resources/json/config/database/ldap/ldap.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/database/ldap/ldap.feature rename to jans-config-api/server/src/test/resources/json/config/database/ldap/ldap.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/database/ldap/ldap.json b/jans-config-api/server/src/test/resources/json/config/database/ldap/ldap.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/database/ldap/ldap.json rename to jans-config-api/server/src/test/resources/json/config/database/ldap/ldap.json diff --git a/jans-config-api/server/src/test/resources/feature/config/database/ldap/ldap_list.json b/jans-config-api/server/src/test/resources/json/config/database/ldap/ldap_list.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/database/ldap/ldap_list.json rename to jans-config-api/server/src/test/resources/json/config/database/ldap/ldap_list.json diff --git a/jans-config-api/server/src/test/resources/feature/config/jwks/jwk_key.json b/jans-config-api/server/src/test/resources/json/config/jwks/jwk_key.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/jwks/jwk_key.json rename to jans-config-api/server/src/test/resources/json/config/jwks/jwk_key.json diff --git a/jans-config-api/server/src/test/resources/feature/config/jwks/jwks-all.json b/jans-config-api/server/src/test/resources/json/config/jwks/jwks-all.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/jwks/jwks-all.json rename to jans-config-api/server/src/test/resources/json/config/jwks/jwks-all.json diff --git a/jans-config-api/server/src/test/resources/feature/config/jwks/jwks.feature b/jans-config-api/server/src/test/resources/json/config/jwks/jwks.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/jwks/jwks.feature rename to jans-config-api/server/src/test/resources/json/config/jwks/jwks.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/jwks/jwks.json b/jans-config-api/server/src/test/resources/json/config/jwks/jwks.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/jwks/jwks.json rename to jans-config-api/server/src/test/resources/json/config/jwks/jwks.json diff --git a/jans-config-api/server/src/test/resources/feature/config/jwks/jwks_patch.json b/jans-config-api/server/src/test/resources/json/config/jwks/jwks_patch.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/jwks/jwks_patch.json rename to jans-config-api/server/src/test/resources/json/config/jwks/jwks_patch.json diff --git a/jans-config-api/server/src/test/resources/feature/config/message/message.feature b/jans-config-api/server/src/test/resources/json/config/message/message.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/message/message.feature rename to jans-config-api/server/src/test/resources/json/config/message/message.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/org/org-config.feature b/jans-config-api/server/src/test/resources/json/config/org/org-config.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/org/org-config.feature rename to jans-config-api/server/src/test/resources/json/config/org/org-config.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/authenticationFilters.json b/jans-config-api/server/src/test/resources/json/config/properties/authenticationFilters.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/authenticationFilters.json rename to jans-config-api/server/src/test/resources/json/config/properties/authenticationFilters.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/backchannel/backchannel.feature b/jans-config-api/server/src/test/resources/json/config/properties/backchannel/backchannel.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/backchannel/backchannel.feature rename to jans-config-api/server/src/test/resources/json/config/properties/backchannel/backchannel.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/ciba/ciba.feature b/jans-config-api/server/src/test/resources/json/config/properties/ciba/ciba.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/ciba/ciba.feature rename to jans-config-api/server/src/test/resources/json/config/properties/ciba/ciba.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/ciba/ciba.json b/jans-config-api/server/src/test/resources/json/config/properties/ciba/ciba.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/ciba/ciba.json rename to jans-config-api/server/src/test/resources/json/config/properties/ciba/ciba.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/clientAuthenticationFilters.json b/jans-config-api/server/src/test/resources/json/config/properties/clientAuthenticationFilters.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/clientAuthenticationFilters.json rename to jans-config-api/server/src/test/resources/json/config/properties/clientAuthenticationFilters.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/cors/cors.feature b/jans-config-api/server/src/test/resources/json/config/properties/cors/cors.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/cors/cors.feature rename to jans-config-api/server/src/test/resources/json/config/properties/cors/cors.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/cors/cors.json b/jans-config-api/server/src/test/resources/json/config/properties/cors/cors.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/cors/cors.json rename to jans-config-api/server/src/test/resources/json/config/properties/cors/cors.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/custom.json b/jans-config-api/server/src/test/resources/json/config/properties/custom.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/custom.json rename to jans-config-api/server/src/test/resources/json/config/properties/custom.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/dynamic/registration/registration.feature b/jans-config-api/server/src/test/resources/json/config/properties/dynamic/registration/registration.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/dynamic/registration/registration.feature rename to jans-config-api/server/src/test/resources/json/config/properties/dynamic/registration/registration.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/dynamic/registration/registration.json b/jans-config-api/server/src/test/resources/json/config/properties/dynamic/registration/registration.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/dynamic/registration/registration.json rename to jans-config-api/server/src/test/resources/json/config/properties/dynamic/registration/registration.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/endpoints/endpoints.feature b/jans-config-api/server/src/test/resources/json/config/properties/endpoints/endpoints.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/endpoints/endpoints.feature rename to jans-config-api/server/src/test/resources/json/config/properties/endpoints/endpoints.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/endpoints/endpoints.json b/jans-config-api/server/src/test/resources/json/config/properties/endpoints/endpoints.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/endpoints/endpoints.json rename to jans-config-api/server/src/test/resources/json/config/properties/endpoints/endpoints.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/expiration/expiration.feature b/jans-config-api/server/src/test/resources/json/config/properties/expiration/expiration.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/expiration/expiration.feature rename to jans-config-api/server/src/test/resources/json/config/properties/expiration/expiration.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/expiration/expiration.json b/jans-config-api/server/src/test/resources/json/config/properties/expiration/expiration.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/expiration/expiration.json rename to jans-config-api/server/src/test/resources/json/config/properties/expiration/expiration.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/grant/grant.feature b/jans-config-api/server/src/test/resources/json/config/properties/grant/grant.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/grant/grant.feature rename to jans-config-api/server/src/test/resources/json/config/properties/grant/grant.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/grant/grant.json b/jans-config-api/server/src/test/resources/json/config/properties/grant/grant.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/grant/grant.json rename to jans-config-api/server/src/test/resources/json/config/properties/grant/grant.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/idToken/idToken.feature b/jans-config-api/server/src/test/resources/json/config/properties/idToken/idToken.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/idToken/idToken.feature rename to jans-config-api/server/src/test/resources/json/config/properties/idToken/idToken.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/idToken/idToken.json b/jans-config-api/server/src/test/resources/json/config/properties/idToken/idToken.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/idToken/idToken.json rename to jans-config-api/server/src/test/resources/json/config/properties/idToken/idToken.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/janssenpkcs/janssenpkcs.feature b/jans-config-api/server/src/test/resources/json/config/properties/janssenpkcs/janssenpkcs.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/janssenpkcs/janssenpkcs.feature rename to jans-config-api/server/src/test/resources/json/config/properties/janssenpkcs/janssenpkcs.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/keys/regen/regen.feature b/jans-config-api/server/src/test/resources/json/config/properties/keys/regen/regen.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/keys/regen/regen.feature rename to jans-config-api/server/src/test/resources/json/config/properties/keys/regen/regen.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/keys/regen/regen.json b/jans-config-api/server/src/test/resources/json/config/properties/keys/regen/regen.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/keys/regen/regen.json rename to jans-config-api/server/src/test/resources/json/config/properties/keys/regen/regen.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/metrics/metrics.feature b/jans-config-api/server/src/test/resources/json/config/properties/metrics/metrics.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/metrics/metrics.feature rename to jans-config-api/server/src/test/resources/json/config/properties/metrics/metrics.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/openid/config/config.feature b/jans-config-api/server/src/test/resources/json/config/properties/openid/config/config.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/openid/config/config.feature rename to jans-config-api/server/src/test/resources/json/config/properties/openid/config/config.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/openid/config/config.json b/jans-config-api/server/src/test/resources/json/config/properties/openid/config/config.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/openid/config/config.json rename to jans-config-api/server/src/test/resources/json/config/properties/openid/config/config.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/pairwise/pairwise.feature b/jans-config-api/server/src/test/resources/json/config/properties/pairwise/pairwise.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/pairwise/pairwise.feature rename to jans-config-api/server/src/test/resources/json/config/properties/pairwise/pairwise.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/properties.feature b/jans-config-api/server/src/test/resources/json/config/properties/properties.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/properties.feature rename to jans-config-api/server/src/test/resources/json/config/properties/properties.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/request/object.feature b/jans-config-api/server/src/test/resources/json/config/properties/request/object.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/request/object.feature rename to jans-config-api/server/src/test/resources/json/config/properties/request/object.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/response/modes/modes.feature b/jans-config-api/server/src/test/resources/json/config/properties/response/modes/modes.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/response/modes/modes.feature rename to jans-config-api/server/src/test/resources/json/config/properties/response/modes/modes.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/response/types/type.feature b/jans-config-api/server/src/test/resources/json/config/properties/response/types/type.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/response/types/type.feature rename to jans-config-api/server/src/test/resources/json/config/properties/response/types/type.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/server/cleanup.feature b/jans-config-api/server/src/test/resources/json/config/properties/server/cleanup.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/server/cleanup.feature rename to jans-config-api/server/src/test/resources/json/config/properties/server/cleanup.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/server/cleanup.json b/jans-config-api/server/src/test/resources/json/config/properties/server/cleanup.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/server/cleanup.json rename to jans-config-api/server/src/test/resources/json/config/properties/server/cleanup.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/server/config.feature b/jans-config-api/server/src/test/resources/json/config/properties/server/config.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/server/config.feature rename to jans-config-api/server/src/test/resources/json/config/properties/server/config.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/server/config.json b/jans-config-api/server/src/test/resources/json/config/properties/server/config.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/server/config.json rename to jans-config-api/server/src/test/resources/json/config/properties/server/config.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/server/session/sessionId.feature b/jans-config-api/server/src/test/resources/json/config/properties/server/session/sessionId.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/server/session/sessionId.feature rename to jans-config-api/server/src/test/resources/json/config/properties/server/session/sessionId.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/subject/subject.feature b/jans-config-api/server/src/test/resources/json/config/properties/subject/subject.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/subject/subject.feature rename to jans-config-api/server/src/test/resources/json/config/properties/subject/subject.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/subject/subject.json b/jans-config-api/server/src/test/resources/json/config/properties/subject/subject.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/subject/subject.json rename to jans-config-api/server/src/test/resources/json/config/properties/subject/subject.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/token/token.feature b/jans-config-api/server/src/test/resources/json/config/properties/token/token.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/token/token.feature rename to jans-config-api/server/src/test/resources/json/config/properties/token/token.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/token/token.json b/jans-config-api/server/src/test/resources/json/config/properties/token/token.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/token/token.json rename to jans-config-api/server/src/test/resources/json/config/properties/token/token.json diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/uma/configuration/configuration.feature b/jans-config-api/server/src/test/resources/json/config/properties/uma/configuration/configuration.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/uma/configuration/configuration.feature rename to jans-config-api/server/src/test/resources/json/config/properties/uma/configuration/configuration.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/properties/user/info/userInfo.feature b/jans-config-api/server/src/test/resources/json/config/properties/user/info/userInfo.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/properties/user/info/userInfo.feature rename to jans-config-api/server/src/test/resources/json/config/properties/user/info/userInfo.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/scripts/custom/generic/all-script.json b/jans-config-api/server/src/test/resources/json/config/scripts/custom/generic/all-script.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/scripts/custom/generic/all-script.json rename to jans-config-api/server/src/test/resources/json/config/scripts/custom/generic/all-script.json diff --git a/jans-config-api/server/src/test/resources/feature/config/scripts/custom/generic/custom.feature b/jans-config-api/server/src/test/resources/json/config/scripts/custom/generic/custom.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/scripts/custom/generic/custom.feature rename to jans-config-api/server/src/test/resources/json/config/scripts/custom/generic/custom.feature diff --git a/jans-config-api/server/src/test/resources/feature/config/scripts/custom/generic/post-script.json b/jans-config-api/server/src/test/resources/json/config/scripts/custom/generic/post-script.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/scripts/custom/generic/post-script.json rename to jans-config-api/server/src/test/resources/json/config/scripts/custom/generic/post-script.json diff --git a/jans-config-api/server/src/test/resources/feature/config/scripts/custom/persons/person-script.json b/jans-config-api/server/src/test/resources/json/config/scripts/custom/persons/person-script.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/scripts/custom/persons/person-script.json rename to jans-config-api/server/src/test/resources/json/config/scripts/custom/persons/person-script.json diff --git a/jans-config-api/server/src/test/resources/feature/config/scripts/custom/persons/person-scripts.feature b/jans-config-api/server/src/test/resources/json/config/scripts/custom/persons/person-scripts.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/config/scripts/custom/persons/person-scripts.feature rename to jans-config-api/server/src/test/resources/json/config/scripts/custom/persons/person-scripts.feature diff --git a/jans-config-api/server/src/test/resources/feature/defaultAcr/defaultAcr.feature b/jans-config-api/server/src/test/resources/json/defaultAcr/defaultAcr.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/defaultAcr/defaultAcr.feature rename to jans-config-api/server/src/test/resources/json/defaultAcr/defaultAcr.feature diff --git a/jans-config-api/server/src/test/resources/feature/defaultAcr/defaultAcr.json b/jans-config-api/server/src/test/resources/json/defaultAcr/defaultAcr.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/defaultAcr/defaultAcr.json rename to jans-config-api/server/src/test/resources/json/defaultAcr/defaultAcr.json diff --git a/jans-config-api/server/src/test/resources/feature/health/auth-server-health.feature b/jans-config-api/server/src/test/resources/json/health/auth-server-health.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/health/auth-server-health.feature rename to jans-config-api/server/src/test/resources/json/health/auth-server-health.feature diff --git a/jans-config-api/server/src/test/resources/feature/health/config-api-health.feature b/jans-config-api/server/src/test/resources/json/health/config-api-health.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/health/config-api-health.feature rename to jans-config-api/server/src/test/resources/json/health/config-api-health.feature diff --git a/jans-config-api/server/src/test/resources/feature/health/server-health.feature b/jans-config-api/server/src/test/resources/json/health/server-health.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/health/server-health.feature rename to jans-config-api/server/src/test/resources/json/health/server-health.feature diff --git a/jans-config-api/server/src/test/resources/feature/logging/logging.feature b/jans-config-api/server/src/test/resources/json/logging/logging.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/logging/logging.feature rename to jans-config-api/server/src/test/resources/json/logging/logging.feature diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/admin-ui-client.json b/jans-config-api/server/src/test/resources/json/openid/clients/admin-ui-client.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/admin-ui-client.json rename to jans-config-api/server/src/test/resources/json/openid/clients/admin-ui-client.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/client.json b/jans-config-api/server/src/test/resources/json/openid/clients/client.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/client.json rename to jans-config-api/server/src/test/resources/json/openid/clients/client.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/client_custom_attribute_patch.json b/jans-config-api/server/src/test/resources/json/openid/clients/client_custom_attribute_patch.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/client_custom_attribute_patch.json rename to jans-config-api/server/src/test/resources/json/openid/clients/client_custom_attribute_patch.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/clients.feature b/jans-config-api/server/src/test/resources/json/openid/clients/clients.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/clients.feature rename to jans-config-api/server/src/test/resources/json/openid/clients/clients.feature diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/custom-attribute.feature b/jans-config-api/server/src/test/resources/json/openid/clients/custom-attribute.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/custom-attribute.feature rename to jans-config-api/server/src/test/resources/json/openid/clients/custom-attribute.feature diff --git a/jans-config-api/server/src/test/resources/json/openid/clients/openid-client-get.json b/jans-config-api/server/src/test/resources/json/openid/clients/openid-client-get.json new file mode 100644 index 00000000000..dd926d7db6c --- /dev/null +++ b/jans-config-api/server/src/test/resources/json/openid/clients/openid-client-get.json @@ -0,0 +1,1420 @@ +{ + "start": 0, + "totalEntriesCount": 13, + "entriesCount": 13, + "entries": [ + { + "dn": "inum=1201.43379194-0790-4de1-9bf3-3b67a67928ff,ou=clients,o=jans", + "clientSecret": "puufT8o8AMRK", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/.well-known/scim-configuration" + ], + "claimRedirectUris": [], + "responseTypes": [], + "grantTypes": [ + "client_credentials" + ], + "applicationType": "native", + "contacts": [], + "clientName": "SCIM client", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=1200.2B3821,ou=scopes,o=jans", + "inum=1200.996CEC,ou=scopes,o=jans", + "inum=1200.4214AB,ou=scopes,o=jans", + "inum=1200.985DF8,ou=scopes,o=jans", + "inum=1200.127C1F,ou=scopes,o=jans", + "inum=1200.36F048,ou=scopes,o=jans", + "inum=1200.F88D4B,ou=scopes,o=jans", + "inum=1200.EF4C7A,ou=scopes,o=jans", + "inum=1200.CFDA90,ou=scopes,o=jans", + "inum=1200.FE644E,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": false, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "SCIM client", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=1201.43379194-0790-4de1-9bf3-3b67a67928ff,ou=clients,o=jans", + "inum": "1201.43379194-0790-4de1-9bf3-3b67a67928ff" + }, + { + "dn": "inum=1800.661fe525-107d-4747-b49b-8c67b1ada3b4,ou=clients,o=jans", + "deletable": false, + "clientSecret": "9UZigIRGKXR9", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/admin-ui", + "http://localhost:4100" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code" + ], + "grantTypes": [ + "authorization_code", + "refresh_token", + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans Config Api Client", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=1800.01.75,ou=scopes,o=jans", + "inum=1800.01.76,ou=scopes,o=jans", + "inum=1800.01.77,ou=scopes,o=jans", + "inum=1800.01.78,ou=scopes,o=jans", + "inum=1800.01.71,ou=scopes,o=jans", + "inum=1800.01.72,ou=scopes,o=jans", + "inum=1800.01.73,ou=scopes,o=jans", + "inum=1800.01.74,ou=scopes,o=jans", + "inum=1800.01.79,ou=scopes,o=jans", + "inum=1800.01.067,ou=scopes,o=jans", + "inum=1800.01.80,ou=scopes,o=jans", + "inum=1800.01.81,ou=scopes,o=jans", + "inum=1800.01.64,ou=scopes,o=jans", + "inum=1800.03.1,ou=scopes,o=jans", + "inum=1800.01.65,ou=scopes,o=jans", + "inum=1800.01.66,ou=scopes,o=jans", + "inum=1800.03.3,ou=scopes,o=jans", + "inum=1800.01.67,ou=scopes,o=jans", + "inum=1800.03.2,ou=scopes,o=jans", + "inum=1800.01.60,ou=scopes,o=jans", + "inum=1800.01.61,ou=scopes,o=jans", + "inum=1800.01.62,ou=scopes,o=jans", + "inum=1800.01.63,ou=scopes,o=jans", + "inum=1800.01.68,ou=scopes,o=jans", + "inum=1800.01.69,ou=scopes,o=jans", + "inum=1800.01.70,ou=scopes,o=jans", + "inum=1800.03.5,ou=scopes,o=jans", + "inum=1800.03.4,ou=scopes,o=jans", + "inum=1800.03.7,ou=scopes,o=jans", + "inum=1800.03.6,ou=scopes,o=jans", + "inum=1800.01.10,ou=scopes,o=jans", + "inum=1800.01.11,ou=scopes,o=jans", + "inum=1800.01.12,ou=scopes,o=jans", + "inum=1800.01.17,ou=scopes,o=jans", + "inum=1800.01.18,ou=scopes,o=jans", + "inum=1800.01.19,ou=scopes,o=jans", + "inum=1800.01.13,ou=scopes,o=jans", + "inum=1800.01.14,ou=scopes,o=jans", + "inum=1800.01.15,ou=scopes,o=jans", + "inum=1800.01.16,ou=scopes,o=jans", + "inum=1800.01.86,ou=scopes,o=jans", + "inum=1800.02.2,ou=scopes,o=jans", + "inum=1800.01.87,ou=scopes,o=jans", + "inum=1800.02.1,ou=scopes,o=jans", + "inum=1800.01.88,ou=scopes,o=jans", + "inum=1800.02.4,ou=scopes,o=jans", + "inum=1800.01.89,ou=scopes,o=jans", + "inum=1800.02.3,ou=scopes,o=jans", + "inum=1800.01.82,ou=scopes,o=jans", + "inum=1800.01.83,ou=scopes,o=jans", + "inum=1800.01.84,ou=scopes,o=jans", + "inum=1800.01.85,ou=scopes,o=jans", + "inum=1800.01.90,ou=scopes,o=jans", + "inum=1800.01.91,ou=scopes,o=jans", + "inum=1800.01.92,ou=scopes,o=jans", + "inum=1800.02.6,ou=scopes,o=jans", + "inum=1800.02.5,ou=scopes,o=jans", + "inum=1800.01.31,ou=scopes,o=jans", + "inum=1800.01.32,ou=scopes,o=jans", + "inum=1800.01.33,ou=scopes,o=jans", + "inum=1800.01.34,ou=scopes,o=jans", + "inum=1800.01.30,ou=scopes,o=jans", + "inum=1800.01.39,ou=scopes,o=jans", + "inum=1800.01.35,ou=scopes,o=jans", + "inum=1800.01.36,ou=scopes,o=jans", + "inum=1800.01.37,ou=scopes,o=jans", + "inum=1800.01.38,ou=scopes,o=jans", + "inum=1800.01.3,ou=scopes,o=jans", + "inum=1800.01.20,ou=scopes,o=jans", + "inum=1800.04.14,ou=scopes,o=jans", + "inum=1800.01.21,ou=scopes,o=jans", + "inum=1800.01.2,ou=scopes,o=jans", + "inum=1800.01.22,ou=scopes,o=jans", + "inum=1800.01.5,ou=scopes,o=jans", + "inum=1800.04.12,ou=scopes,o=jans", + "inum=1800.01.23,ou=scopes,o=jans", + "inum=1800.01.4,ou=scopes,o=jans", + "inum=1800.04.13,ou=scopes,o=jans", + "inum=1800.04.10,ou=scopes,o=jans", + "inum=1800.04.11,ou=scopes,o=jans", + "inum=1800.01.1,ou=scopes,o=jans", + "inum=1800.01.28,ou=scopes,o=jans", + "inum=1800.01.29,ou=scopes,o=jans", + "inum=1800.01.24,ou=scopes,o=jans", + "inum=1800.01.25,ou=scopes,o=jans", + "inum=1800.01.26,ou=scopes,o=jans", + "inum=1800.01.27,ou=scopes,o=jans", + "inum=1800.01.7,ou=scopes,o=jans", + "inum=1800.01.6,ou=scopes,o=jans", + "inum=1800.01.9,ou=scopes,o=jans", + "inum=1800.01.8,ou=scopes,o=jans", + "inum=1800.01.53,ou=scopes,o=jans", + "inum=1800.01.54,ou=scopes,o=jans", + "inum=1800.01.55,ou=scopes,o=jans", + "inum=1800.01.56,ou=scopes,o=jans", + "inum=1800.01.50,ou=scopes,o=jans", + "inum=1800.01.51,ou=scopes,o=jans", + "inum=1800.01.52,ou=scopes,o=jans", + "inum=1800.01.57,ou=scopes,o=jans", + "inum=1800.01.58,ou=scopes,o=jans", + "inum=1800.01.59,ou=scopes,o=jans", + "inum=1800.01.42,ou=scopes,o=jans", + "inum=1800.01.43,ou=scopes,o=jans", + "inum=1800.01.44,ou=scopes,o=jans", + "inum=1800.04.2,ou=scopes,o=jans", + "inum=1800.01.45,ou=scopes,o=jans", + "inum=1800.04.1,ou=scopes,o=jans", + "inum=1800.01.40,ou=scopes,o=jans", + "inum=1800.01.41,ou=scopes,o=jans", + "inum=1800.01.46,ou=scopes,o=jans", + "inum=1800.01.47,ou=scopes,o=jans", + "inum=1800.01.49,ou=scopes,o=jans", + "inum=1800.04.8,ou=scopes,o=jans", + "inum=1800.04.7,ou=scopes,o=jans", + "inum=1800.04.9,ou=scopes,o=jans", + "inum=1800.04.4,ou=scopes,o=jans", + "inum=1800.04.3,ou=scopes,o=jans", + "inum=1800.04.6,ou=scopes,o=jans", + "inum=1800.04.5,ou=scopes,o=jans", + "inum=C4F7,ou=scopes,o=jans", + "inum=1200.2B3821,ou=scopes,o=jans", + "inum=1200.996CEC,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true, + "values": [ + "{}" + ], + "value": "{}", + "displayValue": "{}" + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true, + "values": [ + "{}" + ], + "value": "{}", + "displayValue": "{}" + }, + { + "name": "jansTosURILocalized", + "multiValued": true, + "values": [ + "{}" + ], + "value": "{}", + "displayValue": "{}" + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans Config Api Client", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=1800.661fe525-107d-4747-b49b-8c67b1ada3b4,ou=clients,o=jans", + "inum": "1800.661fe525-107d-4747-b49b-8c67b1ada3b4" + }, + { + "dn": "inum=1802.aa63ce7f-e6f7-4fd6-bd5d-e3199d2b110d,ou=clients,o=jans", + "deletable": false, + "clientSecret": "Q1RahPVlcTZF", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [], + "claimRedirectUris": [], + "responseTypes": [ + "code" + ], + "grantTypes": [ + "authorization_code", + "client_credentials", + "refresh_token" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans Config Api Client", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=1800.01.1,ou=scopes,o=jans", + "inum=1800.03.1,ou=scopes,o=jans", + "inum=1800.01.2,ou=scopes,o=jans", + "inum=1800.03.2,ou=scopes,o=jans", + "inum=1800.01.4,ou=scopes,o=jans", + "inum=1800.03.3,ou=scopes,o=jans", + "inum=1800.01.7,ou=scopes,o=jans", + "inum=1800.02.1,ou=scopes,o=jans", + "inum=1800.02.2,ou=scopes,o=jans", + "inum=1800.02.3,ou=scopes,o=jans", + "inum=1800.01.12,ou=scopes,o=jans", + "inum=1800.01.14,ou=scopes,o=jans", + "inum=1800.01.16,ou=scopes,o=jans", + "inum=1800.01.18,ou=scopes,o=jans", + "inum=1800.01.20,ou=scopes,o=jans", + "inum=1800.01.21,ou=scopes,o=jans", + "inum=1800.01.23,ou=scopes,o=jans", + "inum=1800.01.25,ou=scopes,o=jans", + "inum=1800.01.27,ou=scopes,o=jans", + "inum=1800.01.29,ou=scopes,o=jans", + "inum=1800.01.31,ou=scopes,o=jans", + "inum=1800.01.33,ou=scopes,o=jans", + "inum=1800.01.3,ou=scopes,o=jans", + "inum=1800.01.5,ou=scopes,o=jans", + "inum=1800.01.6,ou=scopes,o=jans", + "inum=1800.01.8,ou=scopes,o=jans", + "inum=1800.01.9,ou=scopes,o=jans", + "inum=1800.01.10,ou=scopes,o=jans", + "inum=1800.01.11,ou=scopes,o=jans", + "inum=1800.01.13,ou=scopes,o=jans", + "inum=1800.01.15,ou=scopes,o=jans", + "inum=1800.01.17,ou=scopes,o=jans", + "inum=1800.01.19,ou=scopes,o=jans", + "inum=1800.01.86,ou=scopes,o=jans", + "inum=1800.01.22,ou=scopes,o=jans", + "inum=1800.01.24,ou=scopes,o=jans", + "inum=1800.01.26,ou=scopes,o=jans", + "inum=1800.01.28,ou=scopes,o=jans", + "inum=1800.01.30,ou=scopes,o=jans", + "inum=1800.01.32,ou=scopes,o=jans", + "inum=1800.02.4,ou=scopes,o=jans", + "inum=1800.01.34,ou=scopes,o=jans", + "inum=1800.02.5,ou=scopes,o=jans", + "inum=1800.02.6,ou=scopes,o=jans", + "inum=1800.01.36,ou=scopes,o=jans", + "inum=1800.01.38,ou=scopes,o=jans", + "inum=1800.01.40,ou=scopes,o=jans", + "inum=1800.01.42,ou=scopes,o=jans", + "inum=1800.01.44,ou=scopes,o=jans", + "inum=1800.01.46,ou=scopes,o=jans", + "inum=1800.04.1,ou=scopes,o=jans", + "inum=1800.04.12,ou=scopes,o=jans", + "inum=1800.04.3,ou=scopes,o=jans", + "inum=1800.04.4,ou=scopes,o=jans", + "inum=1800.04.6,ou=scopes,o=jans", + "inum=1800.04.8,ou=scopes,o=jans", + "inum=1800.04.10,ou=scopes,o=jans", + "inum=1800.01.49,ou=scopes,o=jans", + "inum=1800.01.51,ou=scopes,o=jans", + "inum=1800.01.53,ou=scopes,o=jans", + "inum=1800.01.35,ou=scopes,o=jans", + "inum=1800.01.37,ou=scopes,o=jans", + "inum=1800.01.39,ou=scopes,o=jans", + "inum=1800.01.41,ou=scopes,o=jans", + "inum=1800.01.43,ou=scopes,o=jans", + "inum=1800.01.45,ou=scopes,o=jans", + "inum=1800.01.47,ou=scopes,o=jans", + "inum=1800.04.2,ou=scopes,o=jans", + "inum=1800.04.13,ou=scopes,o=jans", + "inum=1800.04.14,ou=scopes,o=jans", + "inum=1800.04.5,ou=scopes,o=jans", + "inum=1800.04.7,ou=scopes,o=jans", + "inum=1800.04.9,ou=scopes,o=jans", + "inum=1800.04.11,ou=scopes,o=jans", + "inum=1800.01.50,ou=scopes,o=jans", + "inum=1800.01.52,ou=scopes,o=jans", + "inum=1800.01.54,ou=scopes,o=jans", + "inum=1800.01.56,ou=scopes,o=jans", + "inum=1800.01.55,ou=scopes,o=jans", + "inum=1800.01.57,ou=scopes,o=jans", + "inum=1800.01.59,ou=scopes,o=jans", + "inum=1800.01.61,ou=scopes,o=jans", + "inum=1800.01.63,ou=scopes,o=jans", + "inum=1800.01.65,ou=scopes,o=jans", + "inum=1800.01.67,ou=scopes,o=jans", + "inum=1800.01.68,ou=scopes,o=jans", + "inum=1800.01.70,ou=scopes,o=jans", + "inum=1800.01.71,ou=scopes,o=jans", + "inum=1800.01.73,ou=scopes,o=jans", + "inum=1800.01.75,ou=scopes,o=jans", + "inum=1800.01.77,ou=scopes,o=jans", + "inum=1800.01.79,ou=scopes,o=jans", + "inum=1800.03.5,ou=scopes,o=jans", + "inum=1800.01.81,ou=scopes,o=jans", + "inum=1800.01.83,ou=scopes,o=jans", + "inum=1800.01.85,ou=scopes,o=jans", + "inum=1800.01.88,ou=scopes,o=jans", + "inum=1800.01.91,ou=scopes,o=jans", + "inum=1800.01.58,ou=scopes,o=jans", + "inum=1800.01.60,ou=scopes,o=jans", + "inum=1800.01.62,ou=scopes,o=jans", + "inum=1800.01.64,ou=scopes,o=jans", + "inum=1800.01.66,ou=scopes,o=jans", + "inum=1800.01.067,ou=scopes,o=jans", + "inum=1800.01.69,ou=scopes,o=jans", + "inum=1800.01.90,ou=scopes,o=jans", + "inum=1800.01.72,ou=scopes,o=jans", + "inum=1800.01.74,ou=scopes,o=jans", + "inum=1800.01.76,ou=scopes,o=jans", + "inum=1800.01.78,ou=scopes,o=jans", + "inum=1800.03.4,ou=scopes,o=jans", + "inum=1800.01.80,ou=scopes,o=jans", + "inum=1800.01.82,ou=scopes,o=jans", + "inum=1800.01.84,ou=scopes,o=jans", + "inum=1800.01.87,ou=scopes,o=jans", + "inum=1800.01.89,ou=scopes,o=jans", + "inum=1800.01.92,ou=scopes,o=jans", + "inum=C4F7,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans Config Api Client", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=1802.aa63ce7f-e6f7-4fd6-bd5d-e3199d2b110d,ou=clients,o=jans", + "inum": "1802.aa63ce7f-e6f7-4fd6-bd5d-e3199d2b110d" + }, + { + "dn": "inum=2000.8cbff150-a535-41a0-a7e8-b4a31c7c5fea,ou=clients,o=jans", + "deletable": false, + "clientSecret": "zcE2bQFuPzFQ", + "frontChannelLogoutUri": "http://localhost:4100/logout", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/admin", + "http://localhost:4100" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code" + ], + "grantTypes": [ + "authorization_code", + "refresh_token", + "client_credentials", + "urn:ietf:params:oauth:grant-type:device_code" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans TUI Client", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "userInfoSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [ + "http://localhost:4100", + "https://pujavs-light-gobbler.gluu.info/admin" + ], + "requestUris": [], + "scopes": [ + "inum=C4F7,ou=scopes,o=jans", + "inum=C4F6,ou=scopes,o=jans", + "inum=43F1,ou=scopes,o=jans", + "inum=764C,ou=scopes,o=jans", + "inum=F0C4,ou=scopes,o=jans", + "inum=B9D2-D6E5,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": true, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "accessTokenLifetime": 2592000, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "updateTokenScriptDns": [ + "inum=2D3E.5A04,ou=scripts,o=jans" + ], + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans TUI Client", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=2000.8cbff150-a535-41a0-a7e8-b4a31c7c5fea,ou=clients,o=jans", + "inum": "2000.8cbff150-a535-41a0-a7e8-b4a31c7c5fea" + }, + { + "dn": "inum=2101.d15ac918-3417-4463-bec5-9ffcfb04bf88,ou=clients,o=jans", + "deletable": false, + "clientSecret": "8Q9EXPRJMYvy", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/kc/realms/jans/kc-jans-authn-rest-bridge/auth-complete" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code", + "token" + ], + "grantTypes": [ + "authorization_code" + ], + "applicationType": "web", + "contacts": [], + "clientName": "kc_saml_openid", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=764C,ou=scopes,o=jans", + "inum=10B2,ou=scopes,o=jans", + "inum=F0C4,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": true, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "description": "Keycloak OpenID client used for SAML authentication", + "displayName": "kc_saml_openid", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=2101.d15ac918-3417-4463-bec5-9ffcfb04bf88,ou=clients,o=jans", + "inum": "2101.d15ac918-3417-4463-bec5-9ffcfb04bf88" + }, + { + "dn": "inum=2102.c52e2c45-477c-448e-b95e-1b0c19701495,ou=clients,o=jans", + "deletable": false, + "clientSecret": "iU2Cwz4mKgZ4", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/kc/realms/jans/dev/null" + ], + "claimRedirectUris": [], + "responseTypes": [ + "token" + ], + "grantTypes": [ + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "kc_scheduler_api", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=1800.01.67,ou=scopes,o=jans", + "inum=1800.01.66,ou=scopes,o=jans", + "inum=1800.01.56,ou=scopes,o=jans", + "inum=1800.01.57,ou=scopes,o=jans", + "inum=1800.01.3,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "description": "keycloak scheduler openid client used to obtain API keys to invoke the config-api", + "displayName": "kc_scheduler_api", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=2102.c52e2c45-477c-448e-b95e-1b0c19701495,ou=clients,o=jans", + "inum": "2102.c52e2c45-477c-448e-b95e-1b0c19701495" + }, + { + "dn": "inum=2103.9baf07d0-70d8-44c1-a2ae-7a7a0a19efe5,ou=clients,o=jans", + "deletable": false, + "clientSecret": "T1eZbi3w1GOC", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/kc/realms/master/kc-jans-authn-rest-bridge/auth-complete" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code", + "token" + ], + "grantTypes": [ + "authorization_code" + ], + "applicationType": "web", + "contacts": [], + "clientName": "kc_master_auth", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=764C,ou=scopes,o=jans", + "inum=10B2,ou=scopes,o=jans", + "inum=F0C4,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "description": "keycloak master realm client used to authenticate administrators", + "displayName": "kc_master_auth", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=2103.9baf07d0-70d8-44c1-a2ae-7a7a0a19efe5,ou=clients,o=jans", + "inum": "2103.9baf07d0-70d8-44c1-a2ae-7a7a0a19efe5" + }, + { + "dn": "inum=2200.09706375-35e2-4232-8c58-0acaa574af59,ou=clients,o=jans", + "deletable": false, + "clientSecret": "mL1EESbrOVh7", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/jans-lock" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code" + ], + "grantTypes": [ + "authorization_code", + "refresh_token", + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans Lock Config Api Client", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=F0C4,ou=scopes,o=jans", + "inum=1800.03.4,ou=scopes,o=jans", + "inum=1800.03.5,ou=scopes,o=jans", + "inum=1800.01.73,ou=scopes,o=jans", + "inum=1800.01.74,ou=scopes,o=jans", + "inum=1800.01.78,ou=scopes,o=jans", + "inum=1800.01.79,ou=scopes,o=jans", + "inum=1800.01.80,ou=scopes,o=jans", + "inum=1800.01.81,ou=scopes,o=jans", + "inum=1800.01.82,ou=scopes,o=jans", + "inum=1800.01.83,ou=scopes,o=jans", + "inum=1800.01.84,ou=scopes,o=jans", + "inum=1800.01.85,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans Lock Config Api Client", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=2200.09706375-35e2-4232-8c58-0acaa574af59,ou=clients,o=jans", + "inum": "2200.09706375-35e2-4232-8c58-0acaa574af59" + }, + { + "dn": "inum=3000.d10c6883-fd86-452f-81b2-b08a86e322ac,ou=clients,o=jans", + "deletable": false, + "clientSecret": "NT6DKunp6dYo", + "frontChannelLogoutUri": "https://pujavs-light-gobbler.gluu.info/jans-casa/autologout", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/jans-casa" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code" + ], + "grantTypes": [ + "authorization_code", + "refresh_token", + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Client for Casa", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "userInfoSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [ + "https://pujavs-light-gobbler.gluu.info/jans-casa/bye.zul" + ], + "requestUris": [], + "scopes": [ + "inum=F0C4,ou=scopes,o=jans", + "inum=43F1,ou=scopes,o=jans", + "inum=10B2,ou=scopes,o=jans", + "inum=341A,ou=scopes,o=jans", + "inum=3000.01.1,ou=scopes,o=jans", + "inum=3000.01.2,ou=scopes,o=jans", + "inum=3000.01.3,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": true, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Client for Casa", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=3000.d10c6883-fd86-452f-81b2-b08a86e322ac,ou=clients,o=jans", + "inum": "3000.d10c6883-fd86-452f-81b2-b08a86e322ac" + }, + { + "dn": "inum=3E20,ou=clients,o=jans", + "clientSecret": "3E20-pujavs-light-gobbler", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://client.example.com/cb" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code", + "id_token" + ], + "grantTypes": [ + "authorization_code", + "implicit", + "refresh_token", + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans Test Requesting Party Client (don't remove)", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "public", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [], + "claims": [], + "trustedClient": true, + "persistClientAuthorizations": false, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans Test Requesting Party Client (don't remove)", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=3E20,ou=clients,o=jans", + "inum": "3E20" + }, + { + "dn": "inum=AB77-1A2B,ou=clients,o=jans", + "clientSecret": "AB77-1A2B-pujavs-light-gobbler", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://client.example.com/cb" + ], + "claimRedirectUris": [ + "https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/uma/gather_claims" + ], + "responseTypes": [ + "code", + "id_token" + ], + "grantTypes": [ + "authorization_code", + "implicit", + "refresh_token", + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans Test Resource Server Client (don't remove)", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "public", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=6D99,ou=scopes,o=jans", + "inum=7D90,ou=scopes,o=jans", + "inum=6D92,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": true, + "persistClientAuthorizations": false, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans Test Resource Server Client (don't remove)", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=AB77-1A2B,ou=clients,o=jans", + "inum": "AB77-1A2B" + }, + { + "dn": "inum=BADA-BADA,ou=clients,o=jans", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/.well-known/openid-configuration" + ], + "claimRedirectUris": [], + "responseTypes": [ + "code" + ], + "grantTypes": [ + "authorization_code" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Agama tests client", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=F0C4,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": false, + "persistClientAuthorizations": false, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Agama tests client", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=BADA-BADA,ou=clients,o=jans", + "inum": "BADA-BADA" + }, + { + "dn": "inum=FF81-2D39,ou=clients,o=jans", + "clientSecret": "FF81-2D39-pujavs-light-gobbler", + "frontChannelLogoutUri": "null", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://pujavs-light-gobbler.gluu.info/jans-auth-rp/home.htm", + "https://client.example.com/cb", + "https://client.example.com/cb1", + "https://client.example.com/cb2" + ], + "claimRedirectUris": [ + "https://pujavs-light-gobbler.gluu.info/jans-auth/restv1/uma/gather_claims" + ], + "responseTypes": [ + "token", + "code", + "id_token" + ], + "grantTypes": [ + "authorization_code", + "implicit", + "refresh_token", + "client_credentials" + ], + "applicationType": "web", + "contacts": [], + "clientName": "Jans Test Client (don't remove)", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "public", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "defaultAcrValues": [], + "postLogoutRedirectUris": [], + "requestUris": [], + "scopes": [ + "inum=F0C4,ou=scopes,o=jans", + "inum=10B2,ou=scopes,o=jans", + "inum=764C,ou=scopes,o=jans", + "inum=43F1,ou=scopes,o=jans", + "inum=341A,ou=scopes,o=jans", + "inum=6D99,ou=scopes,o=jans", + "inum=6D92,ou=scopes,o=jans" + ], + "claims": [], + "trustedClient": true, + "persistClientAuthorizations": false, + "includeClaimsInIdToken": false, + "customAttributes": [ + { + "name": "displayNameLocalized", + "multiValued": true + }, + { + "name": "jansClntURILocalized", + "multiValued": true + }, + { + "name": "jansLogoURILocalized", + "multiValued": true + }, + { + "name": "jansPolicyURILocalized", + "multiValued": true + }, + { + "name": "jansTosURILocalized", + "multiValued": true + } + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "disabled": false, + "authorizedOrigins": [], + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "displayName": "Jans Test Client (don't remove)", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic", + "baseDn": "inum=FF81-2D39,ou=clients,o=jans", + "inum": "FF81-2D39" + } + ] +} \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/json/openid/clients/openid-client-post.json b/jans-config-api/server/src/test/resources/json/openid/clients/openid-client-post.json new file mode 100644 index 00000000000..8d959003b36 --- /dev/null +++ b/jans-config-api/server/src/test/resources/json/openid/clients/openid-client-post.json @@ -0,0 +1,53 @@ +{ + "deletable": false, + "clientSecret": "Test@123", + "frontChannelLogoutSessionRequired": false, + "redirectUris": [ + "https://localhost/admin-ui", + "http://localhost:4100" + ], + "grantTypes": [ + "password" + ], + "applicationType": "web", + "clientName": "test", + "clientNameLocalized": {}, + "logoUriLocalized": {}, + "clientUriLocalized": {}, + "policyUriLocalized": {}, + "tosUriLocalized": {}, + "subjectType": "pairwise", + "idTokenSignedResponseAlg": "RS256", + "tokenEndpointAuthMethod": "client_secret_basic", + "scopes": [ + "inum=F0C4,ou=scopes,o=jans" + ], + "trustedClient": false, + "persistClientAuthorizations": true, + "includeClaimsInIdToken": false, + "customAttributes": [], + "customObjectClasses": [ + "top" + ], + "rptAsJwt": false, + "accessTokenAsJwt": false, + "accessTokenSigningAlg": "RS256", + "disabled": false, + "attributes": { + "runIntrospectionScriptBeforeJwtCreation": false, + "keepClientAuthorizationAfterExpiration": false, + "allowSpontaneousScopes": false, + "backchannelLogoutSessionRequired": false, + "parLifetime": 600, + "requirePar": false, + "dpopBoundAccessToken": false, + "jansDefaultPromptLogin": false, + "minimumAcrLevel": -1 + }, + "description": "Test Client 1", + "displayName": "Test Client 1", + "allAuthenticationMethods": [ + "client_secret_basic" + ], + "authenticationMethod": "client_secret_basic" + } \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/openid-client.json b/jans-config-api/server/src/test/resources/json/openid/clients/openid-client.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/openid-client.json rename to jans-config-api/server/src/test/resources/json/openid/clients/openid-client.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/clients/openid_clients_create.json b/jans-config-api/server/src/test/resources/json/openid/clients/openid_clients_create.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/clients/openid_clients_create.json rename to jans-config-api/server/src/test/resources/json/openid/clients/openid_clients_create.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/scopes/generic_scopes.feature b/jans-config-api/server/src/test/resources/json/openid/scopes/generic_scopes.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/scopes/generic_scopes.feature rename to jans-config-api/server/src/test/resources/json/openid/scopes/generic_scopes.feature diff --git a/jans-config-api/server/src/test/resources/feature/openid/scopes/scope.json b/jans-config-api/server/src/test/resources/json/openid/scopes/scope.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/scopes/scope.json rename to jans-config-api/server/src/test/resources/json/openid/scopes/scope.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/scopes/scopes-all.json b/jans-config-api/server/src/test/resources/json/openid/scopes/scopes-all.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/scopes/scopes-all.json rename to jans-config-api/server/src/test/resources/json/openid/scopes/scopes-all.json diff --git a/jans-config-api/server/src/test/resources/feature/openid/scopes/scopes.feature b/jans-config-api/server/src/test/resources/json/openid/scopes/scopes.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/openid/scopes/scopes.feature rename to jans-config-api/server/src/test/resources/json/openid/scopes/scopes.feature diff --git a/jans-config-api/server/src/test/resources/feature/plugins/plugin-all.json b/jans-config-api/server/src/test/resources/json/plugins/plugin-all.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/plugins/plugin-all.json rename to jans-config-api/server/src/test/resources/json/plugins/plugin-all.json diff --git a/jans-config-api/server/src/test/resources/feature/plugins/plugin.feature b/jans-config-api/server/src/test/resources/json/plugins/plugin.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/plugins/plugin.feature rename to jans-config-api/server/src/test/resources/json/plugins/plugin.feature diff --git a/jans-config-api/server/src/test/resources/feature/session/session.feature b/jans-config-api/server/src/test/resources/json/session/session.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/session/session.feature rename to jans-config-api/server/src/test/resources/json/session/session.feature diff --git a/jans-config-api/server/src/test/resources/feature/smtp/smtp.feature b/jans-config-api/server/src/test/resources/json/smtp/smtp.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/smtp/smtp.feature rename to jans-config-api/server/src/test/resources/json/smtp/smtp.feature diff --git a/jans-config-api/server/src/test/resources/feature/smtp/smtp.json b/jans-config-api/server/src/test/resources/json/smtp/smtp.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/smtp/smtp.json rename to jans-config-api/server/src/test/resources/json/smtp/smtp.json diff --git a/jans-config-api/server/src/test/resources/feature/stat/stat.feature b/jans-config-api/server/src/test/resources/json/stat/stat.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/stat/stat.feature rename to jans-config-api/server/src/test/resources/json/stat/stat.feature diff --git a/jans-config-api/server/src/test/resources/feature/token/client-token.feature b/jans-config-api/server/src/test/resources/json/token/client-token.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/token/client-token.feature rename to jans-config-api/server/src/test/resources/json/token/client-token.feature diff --git a/jans-config-api/server/src/test/resources/feature/uma/resource/resources.feature b/jans-config-api/server/src/test/resources/json/uma/resource/resources.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/uma/resource/resources.feature rename to jans-config-api/server/src/test/resources/json/uma/resource/resources.feature diff --git a/jans-config-api/server/src/test/resources/feature/uma/resource/uma-resource.json b/jans-config-api/server/src/test/resources/json/uma/resource/uma-resource.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/uma/resource/uma-resource.json rename to jans-config-api/server/src/test/resources/json/uma/resource/uma-resource.json diff --git a/jans-config-api/server/src/test/resources/feature/uma/scopes/uma-scope.json b/jans-config-api/server/src/test/resources/json/uma/scopes/uma-scope.json similarity index 100% rename from jans-config-api/server/src/test/resources/feature/uma/scopes/uma-scope.json rename to jans-config-api/server/src/test/resources/json/uma/scopes/uma-scope.json diff --git a/jans-config-api/server/src/test/resources/feature/uma/scopes/umascopes.feature b/jans-config-api/server/src/test/resources/json/uma/scopes/umascopes.feature similarity index 100% rename from jans-config-api/server/src/test/resources/feature/uma/scopes/umascopes.feature rename to jans-config-api/server/src/test/resources/json/uma/scopes/umascopes.feature diff --git a/jans-config-api/server/src/test/resources/karate-config-jenkins.js b/jans-config-api/server/src/test/resources/karate-config-jenkins.js deleted file mode 100644 index 33999c8bcf8..00000000000 --- a/jans-config-api/server/src/test/resources/karate-config-jenkins.js +++ /dev/null @@ -1,82 +0,0 @@ -function() { - - var stream = read('classpath:karate_jenkins.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate_jenkins env :', env); - karate.log('karate_jenkins url :', url); - karate.log('karate_jenkins port :', port); - karate.log('karate_jenkins baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - statUrl: baseUrl + '/jans-config-api/api/v1/stat', - healthUrl: baseUrl + '/jans-config-api/api/v1/health', - acrsUrl: baseUrl + '/jans-config-api/api/v1/acrs', - authConfigurationUrl: baseUrl + '/jans-config-api/api/v1/jans-auth-server/config', - scriptsUrl: baseUrl + '/jans-config-api/api/v1/config/scripts', - cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache', - messageUrl: baseUrl + '/jans-config-api/api/v1/config/message', - jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks', - ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap', - openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients', - scopes_url: baseUrl + '/jans-config-api/api/v1/scopes', - umaresources_url: baseUrl + '/jans-config-api/api/v1/uma/resources', - attributes_url: baseUrl + '/jans-config-api/api/v1/attributes', - smtp_url: baseUrl + '/jans-config-api/api/v1/config/smtp', - logging_url: baseUrl + '/jans-config-api/api/v1/logging', - auth_health_url: baseUrl + '/jans-config-api/api/v1/jans-auth-server/health', - org_configuration_url: baseUrl + '/jans-config-api/api/v1/org', - user_url: baseUrl + '/jans-config-api/api/v1/user', - agama_url: baseUrl + '/jans-config-api/api/v1/agama', - session_url: baseUrl + '/jans-config-api/api/v1/jans-auth-server/session', - plugin_url: baseUrl + '/jans-config-api/api/v1/plugin', - api_config_url: baseUrl + '/jans-config-api/api/v1/api-config', - agama_deployment_url: baseUrl + '/jans-config-api/api/v1/agama-deployment', - clients_authorizations_url: baseUrl + '/jans-config-api/api/v1/clients/authorizations', - token_url: baseUrl + '/jans-config-api/api/v1/token', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/karate-config.js b/jans-config-api/server/src/test/resources/karate-config.js deleted file mode 100644 index b11ca003aa2..00000000000 --- a/jans-config-api/server/src/test/resources/karate-config.js +++ /dev/null @@ -1,82 +0,0 @@ -function() { - - var stream = read('classpath:karate.properties'); - var props = new java.util.Properties(); - props.load(stream); - - var env = props.get('karate.env'); // get java system property 'karate.env' - karate.configure("ssl", true); - - if (!env) { - env = 'dev'; //env can be anything: dev, qa, staging, etc. - } - - var url = props.get('karate.test.url'); - var port = props.get('karate.test.port'); - var baseUrl = url + (port ? ':' + port : ''); - - karate.log('karate env :', env); - karate.log('karate url :', url); - karate.log('karate port :', port); - karate.log('karate baseUrl :', baseUrl); - - var testStream = read('classpath:test.properties'); - var testProps = new java.util.Properties(); - testProps.load(testStream); - karate.log(' testProps = '+testProps); - var testClientId = testProps.get('test.client.id'); - var testClientSecret = testProps.get('test.client.secret'); - var tokenEndpoint = testProps.get('token.endpoint'); - var testScopes = testProps.get('test.scopes'); - var issuer = testProps.get('test.issuer'); - karate.log(' testClientId = '+testClientId); - karate.log(' testClientSecret = '+testClientSecret); - karate.log(' tokenEndpoint = '+tokenEndpoint); - karate.log(' testScopes = '+testScopes); - karate.log(' issuer = '+issuer); - - - var config = { - env: env, - baseUrl: baseUrl, - testProps: testProps, - issuer: issuer, - accessToken: '123', - - statUrl: baseUrl + '/jans-config-api/api/v1/stat', - healthUrl: baseUrl + '/jans-config-api/api/v1/health', - acrsUrl: baseUrl + '/jans-config-api/api/v1/acrs', - authConfigurationUrl: baseUrl + '/jans-config-api/api/v1/jans-auth-server/config', - scriptsUrl: baseUrl + '/jans-config-api/api/v1/config/scripts', - cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache', - messageUrl: baseUrl + '/jans-config-api/api/v1/config/message', - jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks', - ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap', - openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients', - scopes_url: baseUrl + '/jans-config-api/api/v1/scopes', - umaresources_url: baseUrl + '/jans-config-api/api/v1/uma/resources', - attributes_url: baseUrl + '/jans-config-api/api/v1/attributes', - smtp_url: baseUrl + '/jans-config-api/api/v1/config/smtp', - logging_url: baseUrl + '/jans-config-api/api/v1/logging', - auth_health_url: baseUrl + '/jans-config-api/api/v1/jans-auth-server/health', - org_configuration_url: baseUrl + '/jans-config-api/api/v1/org', - user_url: baseUrl + '/jans-config-api/api/v1/user', - agama_url: baseUrl + '/jans-config-api/api/v1/agama', - session_url: baseUrl + '/jans-config-api/api/v1/jans-auth-server/session', - plugin_url: baseUrl + '/jans-config-api/api/v1/plugin', - api_config_url: baseUrl + '/jans-config-api/api/v1/api-config', - agama_deployment_url: baseUrl + '/jans-config-api/api/v1/agama-deployment', - clients_authorizations_url: baseUrl + '/jans-config-api/api/v1/clients/authorizations', - token_url: baseUrl + '/jans-config-api/api/v1/token', - - }; - - karate.configure('connectTimeout', 30000); - karate.configure('readTimeout', 60000); - - var result = karate.callSingle('classpath:token.feature', config); - print(' result.response = '+result.response); - config.accessToken = result.response.access_token; - - return config; -} \ No newline at end of file diff --git a/jans-config-api/server/src/test/resources/karate.properties b/jans-config-api/server/src/test/resources/karate.properties deleted file mode 100644 index 41c0d369aff..00000000000 --- a/jans-config-api/server/src/test/resources/karate.properties +++ /dev/null @@ -1,5 +0,0 @@ -#karate.test.url=http://localhost -#karate.test.port=8080 -#karate.test.url=https://jenkins-config-api.gluu.org/jans-config-api -#karate.test.port=443 -karate.test.url=${test.server} diff --git a/jans-config-api/server/src/test/resources/karate_jenkins.properties b/jans-config-api/server/src/test/resources/karate_jenkins.properties deleted file mode 100644 index 0b44a8d7b13..00000000000 --- a/jans-config-api/server/src/test/resources/karate_jenkins.properties +++ /dev/null @@ -1,2 +0,0 @@ -karate.test.url=${test.server} -#karate.test.port=443 diff --git a/jans-config-api/server/src/test/resources/log4j2-test.xml b/jans-config-api/server/src/test/resources/log4j2-test.xml new file mode 100644 index 00000000000..28f0d2bef4d --- /dev/null +++ b/jans-config-api/server/src/test/resources/log4j2-test.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/server/src/test/resources/test.properties b/jans-config-api/server/src/test/resources/test.properties index 4257f297907..49f972499b8 100644 --- a/jans-config-api/server/src/test/resources/test.properties +++ b/jans-config-api/server/src/test/resources/test.properties @@ -1,8 +1,64 @@ test.scopes=${test.scopes} # Test env Setting -token.endpoint=${token.endpoint} -token.grant.type=${token.grant.type} -test.client.id=${test.client.id} -test.client.secret=${test.client.secret} -test.issuer=${test.issuer} \ No newline at end of file +#token.endpoint=${token.endpoint} +#token.grant.type=${token.grant.type} +#test.client.id=${test.client.id} +#test.client.secret=${test.client.secret} +#test.issuer=${test.issuer} + +test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/fido2.delete https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session https://jans.io/oauth/config/read-all https://jans.io/oauth/config/write-all https://jans.io/oauth/config/delete-all https://jans.io/oauth/config/openid-read https://jans.io/oauth/config/openid-write https://jans.io/oauth/config/openid-delete https://jans.io/oauth/config/uma-read https://jans.io/oauth/config/uma-write https://jans.io/oauth/config/uma-delete https://jans.io/oauth/jans-auth-server/config/adminui/user/role.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/role.write https://jans.io/oauth/jans-auth-server/config/adminui/read-all https://jans.io/oauth/jans-auth-server/config/adminui/write-all https://jans.io/oauth/jans-auth-server/config/adminui/user/role.delete https://jans.io/oauth/jans-auth-server/config/adminui/delete-all https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.write https://jans.io/oauth/jans-auth-server/config/adminui/user/permission.delete https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.readonly https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.write https://jans.io/oauth/jans-auth-server/config/adminui/user/rolePermissionMapping.delete https://jans.io/oauth/jans-auth-server/config/adminui/license.readonly https://jans.io/oauth/jans-auth-server/config/adminui/license.write https://jans.io/oauth/config/plugin.readonly https://jans.io/oauth/client/authorizations.readonly https://jans.io/oauth/client/authorizations.delete https://jans.io/oauth/config/cacherefresh.readonly https://jans.io/oauth/config/cacherefresh.write https://jans.io/oauth/config/saml.readonly https://jans.io/oauth/config/saml.write https://jans.io/oauth/config/saml-config.readonly https://jans.io/oauth/config/saml-config.write https://jans.io/oauth/config/saml-client-scope.readonly https://jans.io/oauth/config/saml-client-scope.write https://jans.io/idp/config.readonly https://jans.io/idp/config.write https://jans.io/idp/realm.readonly https://jans.io/idp/realm.write https://jans.io/idp/realm.write https://jans.io/idp/saml.readonly https://jans.io/idp/saml.write https://jans.io/oauth/config/app-version.readonly https://jans.io/oauth/kc-link-config.readonly https://jans.io/oauth/kc-link-config.write https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://pujavs-definite-dory.gluu.info/jans-config-api/api/v1/jans-assets/upload-asset https://jans.io/oauth/config/jans_asset-write https://jans.io/oauth/config/jans_asset-delete https://jans.io/oauth/lock/read-all https://jans.io/oauth/lock/write-all https://jans.io/oauth/lock-config.readonly https://jans.io/oauth/lock-config.write https://jans.io/oauth/lock/audit.readonly https://jans.io/oauth/lock/audit.write https://jans.io/oauth/lock/health.readonly https://jans.io/oauth/lock/health.write https://jans.io/oauth/lock/log.readonly https://jans.io/oauth/lock/log.write https://jans.io/oauth/lock/telemetry.readonly https://jans.io/oauth/lock/telemetry.write https://jans.io/oauth/config/token.readonly https://jans.io/oauth/config/token.write https://jans.io/oauth/config/token.delete +# Test env Setting +token.endpoint=https://pujavs-informed-boar.gluu.info/jans-auth/restv1/token +token.grant.type=client_credentials +test.client.id=1800.3f0358fa-d6f6-483e-a7a0-d2ca95609afc +test.client.secret=fA5wnwls35Ln +test.issuer=https://pujavs-informed-boar.gluu.info + + + +statUrl=/jans-config-api/api/v1/stat +healthUrl=/jans-config-api/api/v1/health +acrsUrl=/jans-config-api/api/v1/acrs +apiConfigtionUrl=/jans-config-api/api/v1/api-config +authConfigurationUrl=/jans-config-api/api/v1/jans-auth-server/config +scriptsUrl=/jans-config-api/api/v1/config/scripts +cacheUrl=/jans-config-api/api/v1/config/cache +messageUrl=/jans-config-api/api/v1/config/message +jwksUrl=/jans-config-api/api/v1/config/jwks +ldapUrl=/jans-config-api/api/v1/config/database/ldap +openidClientsUrl=/jans-config-api/api/v1/openid/clients +scopesUrl=/jans-config-api/api/v1/scopes +umaresourcesUrl=/jans-config-api/api/v1/uma/resources +attributesUrl=/jans-config-api/api/v1/attributes +smtpUrl=/jans-config-api/api/v1/config/smtp +loggingUrl=/jans-config-api/api/v1/logging +authHealthUrl=/jans-config-api/api/v1/jans-auth-server/health +orgConfigurationUrl=/jans-config-api/api/v1/org +userUrl=/jans-config-api/api/v1/user +agamaUrl=/jans-config-api/api/v1/agama +sessionUrl=/jans-config-api/api/v1/jans-auth-server/session +pluginUrl=/jans-config-api/api/v1/plugin +apiConfigUrl=/jans-config-api/api/v1/api-config +agamaDeploymentUrl=/jans-config-api/api/v1/agama-deployment +clientsAuthorizationsUrl=/jans-config-api/api/v1/clients/authorizations +tokenUrl=/jans-config-api/api/v1/token + + +#apiConfigtion +api_config_patch_1=file:target/test-classes/json/config/api/api-config-patch.json + +#apiConfigtion +auth_config_patch_1=file:target/test-classes/json/config/auth/auth-config-patch.json + +#defaultAcr +#default_acr_1=file:target/test-classes/json/acr/defaultAcr.json + +#openid-client +openid_client_1=file:target/test-classes/json/openid/clients/openid-client-post.json +openid_client_2=file:target/test-classes/json/openid/clients/client.json + + +#openid-scopes +openid_scopes_1=file:target/test-classes/json/openid/scopes/scope.json + diff --git a/jans-config-api/server/src/test/resources/testClient.feature b/jans-config-api/server/src/test/resources/testClient.feature deleted file mode 100644 index 34cfdffc438..00000000000 --- a/jans-config-api/server/src/test/resources/testClient.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - -Background: -* def mainUrl = test_url - -Scenario: Get Token -Given url mainUrl -And print url -And request '' -When method POST -Then status 204 -And print response diff --git a/jans-config-api/server/src/test/resources/testng.xml b/jans-config-api/server/src/test/resources/testng.xml new file mode 100644 index 00000000000..57d82799235 --- /dev/null +++ b/jans-config-api/server/src/test/resources/testng.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jans-config-api/server/src/test/resources/token.feature b/jans-config-api/server/src/test/resources/token.feature deleted file mode 100644 index ef0ad0d262d..00000000000 --- a/jans-config-api/server/src/test/resources/token.feature +++ /dev/null @@ -1,45 +0,0 @@ -@ignore -Feature: This Feature is to get token to test the test cases - Do not remove ignore tag - -Background: -* def mainUrl = testProps.get('token.endpoint'); -* def grantType = testProps.get('token.grant.type'); -* def clientId = testProps.get('test.client.id'); -* def clientSecret = testProps.get('test.client.secret'); -* def scopes = testProps.get('test.scopes'); -* def authStr = clientId+':'+clientSecret -* def Base64 = Java.type('java.util.Base64') -* def encodedAuth = Base64.encoder.encodeToString(authStr.bytes) -* def encodedScopes = java.net.URLDecoder.decode(scopes, 'UTF-8') - - -Scenario: Get Token -Given url mainUrl -And print 'mainUrl = '+mainUrl -And print 'grantType = '+grantType -And print 'clientId = '+clientId -And print 'clientSecret = '+clientSecret -And print 'scopes = '+scopes -And print 'authStr = '+authStr -And print 'encodedAuth = '+encodedAuth -And print 'encodedScopes = '+encodedScopes -And header Accept = 'application/json' -And header Authorization = 'Basic '+encodedAuth -And form field grant_type = grantType -And form field scope = scopes -When method POST -Then status 200 -And print 'token response = '+response - - - - -#Scenario: Get Token -#Given url 'https://pujavs.jans.server/jans-auth/restv1/token' -#And header Accept = 'application/json' -#And header Authorization = 'Basic MTgwMi45ZGNkOThhZC1mZTJjLTRmZDktYjcxNy1kOTQzNmQ5ZjIwMDk6dGVzdDEyMzQ=' -#And form field grant_type = 'client_credentials' -#And form field scope = 'https://jans.io/oauth/config/openid/clients.readonly' -#When method POST -#Then status 200 -#And print 'token response = '+response diff --git a/jans-config-api/shared/pom.xml b/jans-config-api/shared/pom.xml index 15efc9f1800..8ed902e773a 100644 --- a/jans-config-api/shared/pom.xml +++ b/jans-config-api/shared/pom.xml @@ -13,6 +13,10 @@ + + io.jans + jans-auth-client + io.jans jans-auth-common @@ -54,6 +58,12 @@ org.apache.commons commons-collections4 + + + + org.testng + testng + diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/BaseTest.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/BaseTest.java new file mode 100644 index 00000000000..ac125ee0930 --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/BaseTest.java @@ -0,0 +1,203 @@ +/* + * Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.core.test; + +import io.jans.as.model.common.GrantType; +import io.jans.as.model.util.Util; +import io.jans.configapi.core.test.service.HttpService; +import io.jans.configapi.core.test.service.ResteasyService; +import io.jans.configapi.core.test.service.TokenService; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; +import java.net.URLEncoder; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; +import org.testng.ITestContext; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; + +public class BaseTest { + + private static final String FILE_PREFIX = "file:"; + private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; + private static final String NEW_LINE = System.getProperty("line.separator"); + protected static final String CONTENT_TYPE = "Content-Type"; + protected static final String AUTHORIZATION = "Authorization"; + protected static final String AUTHORIZATION_TYPE = "Bearer"; + + protected Logger log = LogManager.getLogger(getClass()); + protected Base64 base64; + protected static Map propertiesMap = null; + protected ResteasyService resteasyService = new ResteasyService();; + protected HttpService httpService = new HttpService(); + protected TokenService tokenService = new TokenService(); + protected String accessToken; + + @BeforeSuite + public void initTestSuite(ITestContext context) { + String propertiesFile = context.getCurrentXmlTest().getParameter("propertiesFile"); + log.info("Invoked initTestSuite propertiesFile '{}'", propertiesFile); + propertiesMap = context.getSuite().getXmlSuite().getParameters(); + log.info("End initTestSuite propertiesMap: {}", propertiesMap); + } + + @BeforeMethod + public void getAccessToken() { + log.info("getAccessToken - propertiesMap:{}", propertiesMap); + String tokenUrl = propertiesMap.get("token.endpoint"); + String strGrantType = propertiesMap.get("token.grant.type"); + String clientId = propertiesMap.get("test.client.id"); + String clientSecret = propertiesMap.get("test.client.secret"); + String scopes = propertiesMap.get("test.scopes"); + GrantType grantType = GrantType.fromString(strGrantType); + this.accessToken = getToken(tokenUrl, clientId, clientSecret, grantType, scopes); + log.info("accessToken:{}", accessToken); + } + + protected String getToken(final String tokenUrl, final String clientId, final String clientSecret, + GrantType grantType, final String scopes) { + return getTokenService().getToken(tokenUrl, clientId, clientSecret, grantType, scopes); + } + + protected String getIssuer() { + return propertiesMap.get("test.issuer"); + } + + protected HttpService getHttpService() { + return this.httpService; + } + + protected ResteasyService getResteasyService() { + return this.resteasyService; + } + + protected TokenService getTokenService() { + return this.tokenService; + } + + protected String getCredentials(final String clientId, final String clientSecret) + throws UnsupportedEncodingException { + return URLEncoder.encode(clientId, Util.UTF8_STRING_ENCODING) + ":" + + URLEncoder.encode(clientSecret, Util.UTF8_STRING_ENCODING); + } + + /** + * Returns the client credentials encoded using base64. + * + * @return The encoded client credentials. + */ + protected String getEncodedCredentials() { + try { + String clientId = propertiesMap.get("test.client.id"); + String clientSecret = propertiesMap.get("test.client.secret"); + if (StringUtils.isNotBlank(clientId) && StringUtils.isNotBlank(clientSecret)) { + return Base64.encodeBase64String(Util.getBytes(getCredentials(clientId, clientSecret))); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + return null; + } + + protected String decodeFileValue(String value) { + log.info("decodeFileValue"); + String decoded = value; + if (value.startsWith(FILE_PREFIX)) { + value = value.substring(FILE_PREFIX.length()); // remove the prefix + + try (BufferedReader bfr = Files.newBufferedReader(Paths.get(value), DEFAULT_CHARSET)) { // create reader + // appends every line after another + decoded = bfr.lines().reduce("", (partial, next) -> partial + NEW_LINE + next); + if (decoded.length() == 0) + log.warn("Key '{}' is empty", value); + } catch (IOException e) { + log.error(e.getMessage(), e); + decoded = null; + } + } + + log.info("decodeFileValue - decoded:{}", decoded); + return decoded; + } + + protected boolean isServiceDeployed(String serviceName) { + log.info("*** Check if service is deployed - serviceName:{} :{}", serviceName, " *** \n\n\n"); + boolean isDeployed = false; + try { + Class.forName(serviceName); + isDeployed = true; + log.info("*** service:{} is deployed", serviceName); + } catch (ClassNotFoundException ex) { + log.info("*** service:{} is NOT deployed", serviceName); + isDeployed = false; + return isDeployed; + } + return isDeployed; + } + + protected boolean isEndpointAvailable(String url, String accessToken) { + log.info("*** Check if endpoint available - url:{}, accessToken:{}", url, accessToken); + boolean isEndpointAvailable = false; + try { + url = getIssuer() + url; + Response response = getResteasyService().executeGet(url, accessToken); + log.error("*** \n\n\n Check endpoint url:{}, response:{} {}", url, response, "\n\n\n"); + if (response != null) { + log.error("*** \n\n\n Response for endpoint url:{}, response.getStatus():{} {}", url, + response.getStatus(), "\n\n\n"); + if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { + isEndpointAvailable = false; + } else { + isEndpointAvailable = true; + } + } + + } catch (Exception ex) { + log.info("Endpoint:{} is NOT available", url); + ex.printStackTrace(); + isEndpointAvailable = false; + return isEndpointAvailable; + } + log.info("*** \n\n\n Endpoint:{} available:{} {}", url, isEndpointAvailable, "\n\n\n"); + return isEndpointAvailable; + } + + protected Response executeGet(final String url, final String clientId, final String clientSecret, + final String authType, final String authCode, final Map parameters, + ContentType contentType) { + log.info( + "Data for executing GET request - url:{}, clientId:{}, clientSecret:{} , authType:{}, authCode:{} , parameters:{}, contentType:{}", + url, clientId, clientSecret, authType, authCode, parameters, contentType); + return getResteasyService().executeGet(url, clientId, clientSecret, authType, authCode, parameters, + contentType); + } + + protected Response executePost(final String url, final Map parameters, + ContentType contentType) { + log.info( + "Data for executing GET request - url:{}, clientId:{}, clientSecret:{} , authType:{}, authCode:{} , parameters:{}, contentType:{}", + url, clientId, clientSecret, authType, authCode, parameters, contentType); + return getResteasyService().executeGet(url, clientId, clientSecret, authType, authCode, parameters, + contentType); + } + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/AlterSuiteListener.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/AlterSuiteListener.java new file mode 100644 index 00000000000..2170dfab3a6 --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/AlterSuiteListener.java @@ -0,0 +1,83 @@ +package io.jans.configapi.core.test.listener; + +import io.jans.util.security.SecurityProviderUtility; + +import static java.nio.charset.StandardCharsets.UTF_8; +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.Properties; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.testng.IAlterSuiteListener; +import org.testng.xml.XmlSuite; + +public class AlterSuiteListener implements IAlterSuiteListener { + + static PersistenceType persistenceType; + + private static final String FILE_PREFIX = "file:"; + private static final Charset DEFAULT_CHARSET = UTF_8; + private static final String NEW_LINE = System.getProperty("line.separator"); + + private Logger logger = LogManager.getLogger(getClass()); + + @Override + public void alter(List suites) { + + try { + SecurityProviderUtility.installBCProvider(); + logger.info("\n\n Parsing XML suite"); + XmlSuite suite = suites.get(0); + + // Properties with the file: preffix will point to real .json files stored under + // src/test/resources folder + String propertiesFile = suite.getParameter("propertiesFile"); + + Properties prop = new Properties(); + prop.load(Files.newBufferedReader(Paths.get(propertiesFile), DEFAULT_CHARSET)); + + persistenceType = PersistenceType.fromString(prop.getProperty("persistenceType")); + logger.info("Using persistence type = {}", persistenceType); + + Map parameters = new HashMap<>(); + prop.forEach( + (Object key, Object value) -> parameters.put(key.toString(), decodeFileValue(value.toString()))); + // Override test parameters + suite.setParameters(parameters); + + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + + } + + private String decodeFileValue(String value) { + logger.debug("\n\n decodeFileValue"); + String decoded = value; + if (value.startsWith(FILE_PREFIX)) { + value = value.substring(FILE_PREFIX.length()); // remove the prefix + + try (BufferedReader bfr = Files.newBufferedReader(Paths.get(value), DEFAULT_CHARSET)) { // create reader + // appends every line after another + decoded = bfr.lines().reduce("", (partial, next) -> partial + NEW_LINE + next); + if (decoded.length() == 0) + logger.warn("Key '{}' is empty", value); + } catch (IOException e) { + logger.error(e.getMessage(), e); + decoded = null; + } + } + + logger.debug("\n\n decodeFileValue - decoded:{}", decoded); + return decoded; + + } + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/ApiUnitTestListener.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/ApiUnitTestListener.java new file mode 100644 index 00000000000..b374dfc084b --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/ApiUnitTestListener.java @@ -0,0 +1,77 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2021, Janssen Project + */ +package io.jans.configapi.core.test.listener; + +import org.testng.ITestContext; +import org.testng.ITestListener; +import org.testng.ITestResult; +import org.testng.Reporter; + +import com.google.common.base.Throwables; + +public class ApiUnitTestListener implements ITestListener { + + @Override + public void onTestStart(ITestResult result) { + Reporter.log("Test STARTED: " + getTestInfo(result), true); + } + + @Override + public void onTestSuccess(ITestResult result) { + Reporter.log("Test SUCCESS: " + getTestInfo(result), true); + Reporter.log("", true); + } + + @Override + public void onTestFailure(ITestResult result) { + Reporter.log("Test FAILED: " + getTestInfo(result), true); + testFailed(result); + } + + @Override + public void onTestSkipped(ITestResult result) { + Reporter.log("Test SKIPPED: " + getTestInfo(result), true); + Reporter.log("", true); + } + + @Override + public void onTestFailedButWithinSuccessPercentage(ITestResult result) { + Reporter.log("Test FAILED with Success Percentage: " + getTestInfo(result), true); + testFailed(result); + } + + @Override + public void onStart(ITestContext context) { + Reporter.log("Test onStart ", true); + } + + @Override + public void onFinish(ITestContext context) { + Reporter.log("Test onFinish ", true); + } + + private void testFailed(ITestResult result) { + Object[] parameters = result.getParameters(); + if (parameters != null) { + Reporter.log("Test Parameters: ", true); + for (Object parameter : parameters) { + Reporter.log("parameter = " + parameter, true); + } + } + Throwable throwable = result.getThrowable(); + if (throwable != null) { + Reporter.log("", true); + Reporter.log("Exception: ", true); + Reporter.log(Throwables.getStackTraceAsString(result.getThrowable()), true); + Reporter.log("", true); + } + } + + private String getTestInfo(ITestResult result) { + return result.getInstanceName() + "." + result.getName(); + } + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/PersistenceType.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/PersistenceType.java new file mode 100644 index 00000000000..3b235c6b130 --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/PersistenceType.java @@ -0,0 +1,15 @@ +package io.jans.configapi.core.test.listener; + +import io.jans.util.StringHelper; +import java.util.stream.Stream; + +public enum PersistenceType { + LDAP, COUCHBASE, SPANNER, SQL; + + public static PersistenceType fromString(String from) { + return Stream.of(PersistenceType.values()) + .filter(bt -> StringHelper.equalsIgnoreCase(bt.name(), from)) + .findFirst().orElse(null); + } + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTest.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTest.java new file mode 100644 index 00000000000..cd8ef5e2aea --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTest.java @@ -0,0 +1,17 @@ +package io.jans.configapi.core.test.listener; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.METHOD}) +public @interface SkipTest { + + /** + * See valid values for databases in enum {@link PersistenceType} + */ + String[] databases() default {}; + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTestsListener.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTestsListener.java new file mode 100644 index 00000000000..cad279b4863 --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/listener/SkipTestsListener.java @@ -0,0 +1,39 @@ +package io.jans.configapi.core.test.listener; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.stream.Stream; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.testng.IAnnotationTransformer; +import org.testng.annotations.ITestAnnotation; + +public class SkipTestsListener implements IAnnotationTransformer { + + private Logger logger = LogManager.getLogger(getClass()); + + public void transform(ITestAnnotation annotation, Class testClass, + Constructor testConstructor, Method testMethod) { + + if (testMethod != null) { + // Try to find SkipTest annotation at method level or at class level + SkipTest skipper = testMethod.getAnnotation(SkipTest.class); + + if (skipper == null) { + skipper = testMethod.getDeclaringClass().getAnnotation(SkipTest.class); + } + + if (skipper != null) { + // Search for a match with value of BaseTest.persistenceType (it's computed before suite) + boolean disable = Stream.of(skipper.databases()) + .map(PersistenceType::fromString).anyMatch(AlterSuiteListener.persistenceType::equals); + + if (disable) { + logger.warn("Disabling test method {}", testMethod.getName()); + annotation.setEnabled(false); + } + } + } + } + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/HttpService.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/HttpService.java new file mode 100644 index 00000000000..5ebb5a46880 --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/HttpService.java @@ -0,0 +1,373 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.core.test.service; + +import io.jans.model.net.HttpServiceResponse; +import io.jans.util.StringHelper; + +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.util.Map; +import java.util.Map.Entry; + +import javax.net.ssl.SSLContext; + +import jakarta.annotation.PostConstruct; +import jakarta.servlet.http.HttpServletRequest; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import org.apache.commons.codec.binary.Base64; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.routing.HttpRoutePlanner; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.DefaultProxyRoutePlanner; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.ssl.TrustStrategy; +import org.apache.http.util.EntityUtils; + +public class HttpService implements Serializable { + + private static final long serialVersionUID = -2398422090669045605L; + protected transient Logger log = LogManager.getLogger(getClass()); + private static final String CON_STATS_STR = "Connection manager stats: {}"; + private transient Base64 base64; + + private transient PoolingHttpClientConnectionManager connectionManager; + + @PostConstruct + public void init() { + connectionManager = new PoolingHttpClientConnectionManager(); + connectionManager.setMaxTotal(200); // Increase max total connection to 200 + connectionManager.setDefaultMaxPerRoute(50); // Increase default max connection per route to 50 + + this.base64 = new Base64(); + } + + public CloseableHttpClient getHttpsClientTrustAll() + throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException { + log.trace(CON_STATS_STR, connectionManager.getTotalStats()); + + TrustStrategy acceptingTrustStrategy = (cert, authType) -> true; + SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); + SSLConnectionSocketFactory sslConSocFactory = new SSLConnectionSocketFactory(sslContext, + NoopHostnameVerifier.INSTANCE); + + return HttpClients.custom().setSSLSocketFactory(sslConSocFactory) + .setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build()) + .setConnectionManager(connectionManager).build(); + } + + public CloseableHttpClient getHttpsClient() { + return getHttpsClient(RequestConfig.custom().build()); + } + + public CloseableHttpClient getHttpsClient(RequestConfig requestConfig) { + log.trace(CON_STATS_STR, connectionManager.getTotalStats()); + + return HttpClients.custom() + .setDefaultRequestConfig(RequestConfig.copy(requestConfig).setCookieSpec(CookieSpecs.STANDARD).build()) + .setConnectionManager(connectionManager).build(); + } + + public CloseableHttpClient getHttpsClient(HttpRoutePlanner routerPlanner) { + log.trace(CON_STATS_STR, connectionManager.getTotalStats()); + + return getHttpsClient(RequestConfig.custom().build(), routerPlanner); + } + + public CloseableHttpClient getHttpsClient(RequestConfig requestConfig, HttpRoutePlanner routerPlanner) { + log.trace(CON_STATS_STR, connectionManager.getTotalStats()); + + return HttpClients.custom() + .setDefaultRequestConfig(RequestConfig.copy(requestConfig).setCookieSpec(CookieSpecs.STANDARD).build()) + .setConnectionManager(connectionManager).setRoutePlanner(routerPlanner).build(); + } + + public CloseableHttpClient getHttpsClient(String trustStorePath, String trustStorePassword) + throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, + IOException { + log.trace(CON_STATS_STR, connectionManager.getTotalStats()); + + SSLContext sslContext = SSLContexts.custom() + .loadTrustMaterial(new File(trustStorePath), trustStorePassword.toCharArray()).build(); + SSLConnectionSocketFactory sslConSocFactory = new SSLConnectionSocketFactory(sslContext); + + return HttpClients.custom().setSSLSocketFactory(sslConSocFactory) + .setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build()) + .setConnectionManager(connectionManager).build(); + } + + public CloseableHttpClient getHttpsClient(String trustStorePath, String trustStorePassword, String keyStorePath, + String keyStorePassword) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, + CertificateException, IOException, UnrecoverableKeyException { + log.trace(CON_STATS_STR, connectionManager.getTotalStats()); + + SSLContext sslContext = SSLContexts.custom() + .loadTrustMaterial(new File(trustStorePath), trustStorePassword.toCharArray()) + .loadKeyMaterial(new File(keyStorePath), keyStorePassword.toCharArray(), keyStorePassword.toCharArray()) + .build(); + SSLConnectionSocketFactory sslConSocFactory = new SSLConnectionSocketFactory(sslContext); + + return HttpClients.custom().setSSLSocketFactory(sslConSocFactory) + .setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build()) + .setConnectionManager(connectionManager).build(); + } + + public HttpServiceResponse executePost(HttpClient httpClient, String uri, String authCode, + Map headers, String postData, ContentType contentType, String authType) { + + HttpPost httpPost = new HttpPost(uri); + + if (StringHelper.isEmpty(authType)) { + authType = "Basic "; + } else { + authType = authType + " "; + } + if (StringHelper.isNotEmpty(authCode)) { + httpPost.setHeader("Authorization", authType + authCode); + } + + if (contentType == null) { + contentType = ContentType.APPLICATION_JSON; + } + + if (headers != null) { + for (Entry headerEntry : headers.entrySet()) { + httpPost.setHeader(headerEntry.getKey(), headerEntry.getValue()); + } + } + + StringEntity stringEntity = new StringEntity(postData, contentType); + httpPost.setEntity(stringEntity); + + try { + HttpResponse httpResponse = httpClient.execute(httpPost); + + return new HttpServiceResponse(httpPost, httpResponse); + } catch (IOException ex) { + log.error("Failed to execute post request", ex); + } + + return null; + } + + public HttpServiceResponse executePost(HttpClient httpClient, String uri, String authCode, + Map headers, String postData) { + return executePost(httpClient, uri, authCode, headers, postData, null, null); + } + + public HttpServiceResponse executePost(HttpClient httpClient, String uri, String authCode, String postData, + ContentType contentType) { + return executePost(httpClient, uri, authCode, null, postData, contentType, null); + } + + public HttpServiceResponse executePost(String uri, String authCode, String postData, + ContentType contentType, String authType) { + return executePost(this.getHttpsClient(), uri, authCode, null, postData, contentType, authType); + } + + public String encodeBase64(String value) { + return new String(base64.encode((value).getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8); + } + + public String encodeUrl(String value) { + return URLEncoder.encode(value, StandardCharsets.UTF_8); + } + + public HttpServiceResponse executeGet(HttpClient httpClient, String requestUri, Map headers, + Map parameters) { + HttpGet httpGet = new HttpGet(requestUri); + + if (headers != null) { + for (Entry headerEntry : headers.entrySet()) { + httpGet.setHeader(headerEntry.getKey(), headerEntry.getValue()); + } + } + + if (parameters != null && !parameters.isEmpty()) { + StringBuilder query = new StringBuilder(""); + for (String key : parameters.keySet()) { + + String value = parameters.get(key); + if (value != null && value.length() > 0) { + + String delim = "&" + URLEncoder.encode(key, StandardCharsets.UTF_8) + "="; + query.append(delim.substring(1)); + query.append(URLEncoder.encode(value, StandardCharsets.UTF_8)); + } + } + httpGet = new HttpGet(requestUri + query.toString()); + } + + try { + HttpResponse httpResponse = httpClient.execute(httpGet); + + return new HttpServiceResponse(httpGet, httpResponse); + } catch (IOException ex) { + log.error("Failed to execute get request", ex); + } + + return null; + } + + public HttpServiceResponse executeGet(String requestUri, Map headers, Map data) { + HttpClient httpClient = this.getHttpsClient(); + return executeGet(httpClient, requestUri, headers, data); + } + + public HttpServiceResponse executeGet(String requestUri, Map headers) { + HttpClient httpClient = this.getHttpsClient(); + return executeGet(httpClient, requestUri, headers, null); + } + + public HttpServiceResponse executeGet(HttpClient httpClient, String requestUri) { + return executeGet(httpClient, requestUri, null, null); + } + + public byte[] getResponseContent(HttpResponse httpResponse) throws IOException { + if ((httpResponse == null) || !isResponseStastusCodeOk(httpResponse)) { + return null; + } + + HttpEntity entity = httpResponse.getEntity(); + byte[] responseBytes = new byte[0]; + if (entity != null) { + responseBytes = EntityUtils.toByteArray(entity); + } + + // Consume response content + if (entity != null) { + EntityUtils.consume(entity); + } + + return responseBytes; + } + + public void consume(HttpResponse httpResponse) throws IOException { + if ((httpResponse == null) || !isResponseStastusCodeOk(httpResponse)) { + return; + } + + // Consume response content + HttpEntity entity = httpResponse.getEntity(); + if (entity != null) { + EntityUtils.consume(entity); + } + } + + public String convertEntityToString(byte[] responseBytes) { + if (responseBytes == null) { + return null; + } + + return new String(responseBytes); + } + + public String convertEntityToString(byte[] responseBytes, Charset charset) { + if (responseBytes == null) { + return null; + } + + return new String(responseBytes, charset); + } + + public String convertEntityToString(byte[] responseBytes, String charsetName) throws UnsupportedEncodingException { + if (responseBytes == null) { + return null; + } + + return new String(responseBytes, charsetName); + } + + public boolean isResponseStastusCodeOk(HttpResponse httpResponse) { + int responseStastusCode = httpResponse.getStatusLine().getStatusCode(); + if ((responseStastusCode == HttpStatus.SC_OK) || (responseStastusCode == HttpStatus.SC_CREATED) + || (responseStastusCode == HttpStatus.SC_ACCEPTED) + || (responseStastusCode == HttpStatus.SC_NON_AUTHORITATIVE_INFORMATION) + || (responseStastusCode == HttpStatus.SC_NO_CONTENT) + || (responseStastusCode == HttpStatus.SC_RESET_CONTENT) + || (responseStastusCode == HttpStatus.SC_PARTIAL_CONTENT) + || (responseStastusCode == HttpStatus.SC_MULTI_STATUS)) { + return true; + } else { + return false; + } + } + + public boolean isResponseStatusCodeOk(HttpResponse httpResponse) { + return isResponseStastusCodeOk(httpResponse); + } + + public boolean isContentTypeXml(HttpResponse httpResponse) { + Header contentType = httpResponse.getEntity().getContentType(); + if (contentType == null) { + return false; + } + + String contentTypeValue = contentType.getValue(); + if (StringHelper.equals(contentTypeValue, ContentType.APPLICATION_XML.getMimeType()) + || StringHelper.equals(contentTypeValue, ContentType.TEXT_XML.getMimeType())) { + return true; + } else { + return false; + } + } + + public String constructServerUrl(final HttpServletRequest request) { + int serverPort = request.getServerPort(); + + String redirectUrl; + if ((serverPort == 80) || (serverPort == 443)) { + redirectUrl = String.format("%s://%s%s", request.getScheme(), request.getServerName(), + request.getContextPath()); + } else { + redirectUrl = String.format("%s://%s:%s%s", request.getScheme(), request.getServerName(), + request.getServerPort(), request.getContextPath()); + } + + return redirectUrl.toLowerCase(); + } + + public HttpRoutePlanner buildDefaultRoutePlanner(final String hostname, final int port, final String scheme) { + // Creating an HttpHost object for proxy + HttpHost proxyHost = new HttpHost(hostname, port, scheme); + + return new DefaultProxyRoutePlanner(proxyHost); + } + + public HttpRoutePlanner buildDefaultRoutePlanner(final String proxy) { + return buildDefaultRoutePlanner(proxy, -1, null); + } + +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/ResteasyService.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/ResteasyService.java new file mode 100644 index 00000000000..43be5e1ef43 --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/ResteasyService.java @@ -0,0 +1,117 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.core.test.service; + +import io.jans.util.StringHelper; + +import java.io.Serializable; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.Response; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ResteasyService implements Serializable { + + private static final long serialVersionUID = 1L; + private static final String CONTENT_TYPE = "Content-Type"; + private static final String AUTHORIZATION = "Authorization"; + protected transient Logger logger = LogManager.getLogger(getClass()); + + public Builder getClientBuilder(String url) { + return ClientBuilder.newClient().target(url).request(); + } + + public Response executeGet(final String url, final Map headers, + final Map parameters) { + logger.error("\n\n\n *** Execut GET - url:{}, headers:{}, parameters:{}", url, headers, parameters); + StringBuilder query = null; + if (parameters != null && !parameters.isEmpty()) { + query = new StringBuilder(""); + for (Map.Entry entry : parameters.entrySet()) { + String value = entry.getValue(); + if (value != null && value.length() > 0) { + String delim = "&" + URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8) + "="; + query.append(delim.substring(1)); + query.append(URLEncoder.encode(value, StandardCharsets.UTF_8)); + } + } + } + + Builder request = getClientBuilder(url + query); + if (headers != null && !headers.isEmpty()) { + for (Map.Entry header : headers.entrySet()) { + request.header(header.getKey(), header.getValue()); + } + } + + Response response = request.get(); + logger.error(" response:{}", response); + + return response; + } + + public Response executeGet(final String url, final String accessToken) { + logger.error("\n\n\n *** Execut GET - url:{}, accessToken:{}", url, accessToken); + + Builder request = getClientBuilder(url); + if (StringUtils.isNotBlank(accessToken)) { + request.header(AUTHORIZATION, "Bearer " + accessToken); + } + + Response response = request.get(); + logger.error("\n\n\n response:{}", response); + + return response; + } + + public Response executeGet(final String url, final String clientId, final String clientSecret, + final String authType, final String authCode, final Map parameters, + ContentType contentType) { + logger.info( + "Data for executing GET request - url:{}, clientId:{}, clientSecret:{} , authType:{}, authCode:{} , parameters:{}, contentType:{}", + url, clientId, clientSecret, authType, authCode, parameters, contentType); + + StringBuilder query = null; + if (parameters != null && !parameters.isEmpty()) { + query = new StringBuilder(""); + int i = 0; + for (Map.Entry entry : parameters.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (value != null && value.length() > 0) { + String delim = (i==0) ? "?" : "&" ; + query.append(delim + URLEncoder.encode(key, StandardCharsets.UTF_8) + "="); + query.append(URLEncoder.encode(value, StandardCharsets.UTF_8)); + i++; + } + } + } + + Builder request = getClientBuilder(url + query); + if (contentType == null) { + contentType = ContentType.APPLICATION_JSON; + } + request.header(CONTENT_TYPE, contentType); + + if (StringHelper.isNotEmpty(authCode)) { + request.header(AUTHORIZATION, authType + authCode); + } + + Response response = request.get(); + logger.info(" response:{}", response); + + return response; + } +} diff --git a/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/TokenService.java b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/TokenService.java new file mode 100644 index 00000000000..86d001887ae --- /dev/null +++ b/jans-config-api/shared/src/main/java/io/jans/configapi/core/test/service/TokenService.java @@ -0,0 +1,82 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2020, Janssen Project + */ + +package io.jans.configapi.core.test.service; + +import io.jans.as.client.TokenRequest; +import io.jans.as.client.TokenResponse; +import io.jans.as.model.common.GrantType; +import io.jans.configapi.core.test.service.TokenService; + + +import java.io.Serializable; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.Response; + +public class TokenService implements Serializable { + + private static final long serialVersionUID = 1L; + private transient Logger log = LogManager.getLogger(getClass()); + private static final String CONTENT_TYPE = "Content-Type"; + private static final String AUTHORIZATION = "Authorization"; + + public String getToken(final String tokenUrl, final String clientId, final String clientSecret, GrantType grantType, + final String scopes) { + log.info("Request for token tokenUrl:{}, clientId:{}, grantType:{}, scopes:{}", tokenUrl, clientId, grantType, + scopes); + String accessToken = null; + TokenResponse tokenResponse = this.requestAccessToken(tokenUrl, clientId, clientSecret, grantType, scopes); + if (tokenResponse != null) { + accessToken = tokenResponse.getAccessToken(); + log.trace("accessToken:{}, ", accessToken); + } + + return accessToken; + } + + public TokenResponse requestAccessToken(final String tokenUrl, final String clientId, final String clientSecret, + GrantType grantType, final String scope) { + log.info("Request for access token tokenUrl:{}, clientId:{},scope:{}", tokenUrl, clientId, scope); + Response response = null; + try { + if (grantType == null) { + grantType = GrantType.CLIENT_CREDENTIALS; + } + TokenRequest tokenRequest = new TokenRequest(grantType); + tokenRequest.setScope(scope); + tokenRequest.setAuthUsername(clientId); + tokenRequest.setAuthPassword(clientSecret); + Builder request = new ResteasyService().getClientBuilder(tokenUrl); + request.header(AUTHORIZATION, "Basic " + tokenRequest.getEncodedCredentials()); + request.header(CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); + final MultivaluedHashMap multivaluedHashMap = new MultivaluedHashMap<>( + tokenRequest.getParameters()); + response = request.post(Entity.form(multivaluedHashMap)); + log.trace("Response for Access Token - response:{}", response); + if (response.getStatus() == 200) { + String entity = response.readEntity(String.class); + TokenResponse tokenResponse = new TokenResponse(); + tokenResponse.setEntity(entity); + tokenResponse.injectDataFromJson(entity); + return tokenResponse; + } + } finally { + + if (response != null) { + response.close(); + } + } + return null; + } + +}