From d8f9b418ecfd193aa9e18a234bab1f3243e0cbd8 Mon Sep 17 00:00:00 2001 From: cailbourdin Date: Mon, 21 Oct 2024 11:40:53 +0200 Subject: [PATCH] feat: changement git-service-registry pour json-service-registry --- README.md | 2 +- build.gradle | 2 +- src/main/resources/application-test.yml | 6 +-- .../resources/services/servicetest-1.json | 7 ++++ .../resources/services/servicetest-10.json | 17 +++++++++ .../resources/services/servicetest-11.json | 12 ++++++ .../resources/services/servicetest-12.json | 18 +++++++++ .../resources/services/servicetest-13.json | 18 +++++++++ .../resources/services/servicetest-14.json | 18 +++++++++ .../resources/services/servicetest-15.json | 18 +++++++++ .../resources/services/servicetest-16.json | 18 +++++++++ .../resources/services/servicetest-17.json | 30 +++++++++++++++ .../resources/services/servicetest-18.json | 18 +++++++++ .../resources/services/servicetest-19.json | 13 +++++++ .../resources/services/servicetest-2.json | 7 ++++ .../resources/services/servicetest-3.json | 17 +++++++++ .../resources/services/servicetest-4.json | 17 +++++++++ .../resources/services/servicetest-5.json | 23 +++++++++++ .../resources/services/servicetest-6.json | 38 +++++++++++++++++++ .../resources/services/servicetest-7.json | 38 +++++++++++++++++++ .../resources/services/servicetest-8.json | 18 +++++++++ .../resources/services/servicetest-9.json | 18 +++++++++ 22 files changed, 367 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/services/servicetest-1.json create mode 100644 src/main/resources/services/servicetest-10.json create mode 100644 src/main/resources/services/servicetest-11.json create mode 100644 src/main/resources/services/servicetest-12.json create mode 100644 src/main/resources/services/servicetest-13.json create mode 100644 src/main/resources/services/servicetest-14.json create mode 100644 src/main/resources/services/servicetest-15.json create mode 100644 src/main/resources/services/servicetest-16.json create mode 100644 src/main/resources/services/servicetest-17.json create mode 100644 src/main/resources/services/servicetest-18.json create mode 100644 src/main/resources/services/servicetest-19.json create mode 100644 src/main/resources/services/servicetest-2.json create mode 100644 src/main/resources/services/servicetest-3.json create mode 100644 src/main/resources/services/servicetest-4.json create mode 100644 src/main/resources/services/servicetest-5.json create mode 100644 src/main/resources/services/servicetest-6.json create mode 100644 src/main/resources/services/servicetest-7.json create mode 100644 src/main/resources/services/servicetest-8.json create mode 100644 src/main/resources/services/servicetest-9.json diff --git a/README.md b/README.md index 7e49c99..8e2cf09 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Deploy a CAS server using the WAR Overlay method without having to downoad all t This CAS server uses the following modules : - **cas-server-support-ldap** as an authentication method - **cas-server-support-redis-ticket-registry** as the ticket registry -- **cas-server-support-git-service-registry** as the service registry +- **cas-server-support-json-service-registry** as the service registry - **cas-server-support-interrupt-webflow** to interrupt the webflow during the login phase - **cas-server-support-oidc** to enable the OIDC protocol - **cas-server-support-saml-idp** to act as an SAML2 identity provider diff --git a/build.gradle b/build.gradle index d267232..3062c33 100644 --- a/build.gradle +++ b/build.gradle @@ -330,7 +330,7 @@ dependencies { testImplementation "org.springframework.boot:spring-boot-starter-test" implementation "org.apereo.cas:cas-server-support-ldap" implementation "org.apereo.cas:cas-server-support-redis-ticket-registry" - implementation "org.apereo.cas:cas-server-support-git-service-registry" + implementation "org.apereo.cas:cas-server-support-json-service-registry" implementation "org.apereo.cas:cas-server-support-jmx" implementation "org.apereo.cas:cas-server-support-pac4j-webflow" implementation "org.apereo.cas:cas-server-support-interrupt-webflow" diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 71589d5..143c568 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -61,10 +61,8 @@ cas.ticket.registry.redis.sentinel.password: GWMije5VNMe7avz # Service registry cas.service-registry.core.init-from-json: false -cas.service-registry.git.repository-url: https://github.com/nathancailbourdin/cas-git-service-registry-test.git -cas.service-registry.git.active-branch: main -cas.service-registry.git.branches-to-clone: main -cas.service-registry.git.clone-directory.location: file:/tmp/cas-service-registry-test +cas.service-registry.core.init-default-services: false +cas.service-registry.json.location: classpath:/services cas.service-registry.schedule.start-delay: 10000 cas.service-registry.schedule.repeat-interval: 120000 cas.service-registry.cache.duration: 900000 diff --git a/src/main/resources/services/servicetest-1.json b/src/main/resources/services/servicetest-1.json new file mode 100644 index 0000000..ed1f2a7 --- /dev/null +++ b/src/main/resources/services/servicetest-1.json @@ -0,0 +1,7 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8001\/.*", + "name": "Service Test", + "description": "Service de test pour CI avec Puppeteer", + "id": 1 +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-10.json b/src/main/resources/services/servicetest-10.json new file mode 100644 index 0000000..b06d6de --- /dev/null +++ b/src/main/resources/services/servicetest-10.json @@ -0,0 +1,17 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8010\/.*", + "name": "Service Test", + "description": "Service de test pour génération externalid", + "id": 10, + "attributeReleasePolicy": { + "@class": "org.apereo.cas.services.ReturnExternalIDAttributeReleasePolicy", + "internalServiceId": "SERVICE1", + "allowedAttributes": [ "java.util.ArrayList", [ "cn", "mail", "sn" ] ], + "externalIdAttributeName": "externalIdTest" + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-11.json b/src/main/resources/services/servicetest-11.json new file mode 100644 index 0000000..7d88506 --- /dev/null +++ b/src/main/resources/services/servicetest-11.json @@ -0,0 +1,12 @@ +{ + "@class": "org.apereo.cas.support.saml.services.SamlRegisteredService", + "serviceId": "^http:\/\/localhost:8011.*", + "name": "Service Test", + "description": "Service de test pour flow SAML2", + "id": 11, + "metadataLocation": "http://localhost:8011/metadata", + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} diff --git a/src/main/resources/services/servicetest-12.json b/src/main/resources/services/servicetest-12.json new file mode 100644 index 0000000..0233d47 --- /dev/null +++ b/src/main/resources/services/servicetest-12.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^https:\/\/falsevaliddomain\/tokenredirectnoportal.*", + "name": "Service Test", + "description": "Service de test pour token redirection (service non portail)", + "id": 12, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "properties" : { + "@class" : "java.util.HashMap", + "portalRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-13.json b/src/main/resources/services/servicetest-13.json new file mode 100644 index 0000000..2d17c8e --- /dev/null +++ b/src/main/resources/services/servicetest-13.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^https:\/\/falsevaliddomain\/tokenredirectportal.*", + "name": "Service Test", + "description": "Service de test pour token redirection (service portail) avec mauvais token", + "id": 13, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "properties" : { + "@class" : "java.util.HashMap", + "portalRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-14.json b/src/main/resources/services/servicetest-14.json new file mode 100644 index 0000000..8938ded --- /dev/null +++ b/src/main/resources/services/servicetest-14.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^https:\/\/wrongdomain\/tokenredirectnoportal.*", + "name": "Service Test", + "description": "Service de test pour token redirection (service non portail) avec domaine inconnu", + "id": 14, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "properties" : { + "@class" : "java.util.HashMap", + "portalRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-15.json b/src/main/resources/services/servicetest-15.json new file mode 100644 index 0000000..5d3f62f --- /dev/null +++ b/src/main/resources/services/servicetest-15.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^https:\/\/falsevaliddomain\/tokenredirectportal.*", + "name": "Service Test", + "description": "Service de test pour token redirection (service portail) avec bon token", + "id": 15, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "properties" : { + "@class" : "java.util.HashMap", + "portalRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-16.json b/src/main/resources/services/servicetest-16.json new file mode 100644 index 0000000..0be5c03 --- /dev/null +++ b/src/main/resources/services/servicetest-16.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8016\/.*", + "name": "Service Test", + "description": "Service de test pour token redirection post connexion", + "id": 16, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "properties" : { + "@class" : "java.util.HashMap", + "portalRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-17.json b/src/main/resources/services/servicetest-17.json new file mode 100644 index 0000000..c1ba71f --- /dev/null +++ b/src/main/resources/services/servicetest-17.json @@ -0,0 +1,30 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^https:\/\/(mappeddomain1|mappeddomain2)\/tokenredirectnoportal.*", + "name": "Service Test", + "description": "Service de test pour token redirection (service non portail) avec domaine mappé", + "id": 17, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "properties" : { + "@class" : "java.util.HashMap", + "portalRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + }, + "domainRedirectionNeeded" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ true ] ] + }, + "DOMAIN-RED:mappeddomain1" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ "mappeddomain3.fr" ] ] + }, + "DOMAIN-RED:mappeddomain2" : { + "@class" : "org.apereo.cas.services.DefaultRegisteredServiceProperty", + "values" : [ "java.util.HashSet", [ "mappeddomain4.fr" ] ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-18.json b/src/main/resources/services/servicetest-18.json new file mode 100644 index 0000000..5c2fb1f --- /dev/null +++ b/src/main/resources/services/servicetest-18.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.OidcRegisteredService", + "clientId": "client-testcas", + "clientSecret": "secret-testcas", + "serviceId": "^http:\/\/localhost:8018\/.*", + "name": "Service Test", + "description": "Service de test pour OIDC", + "id": 18, + "bypassApprovalPrompt": true, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "generateRefreshToken": "true", + "scopes": [ "java.util.HashSet", [ "openid", "profile", "test" ] ], + "supportedGrantTypes": [ "java.util.HashSet", [ "authorization_code", "refresh_token" ] ], + "supportedResponseTypes": [ "java.util.HashSet", [ "code" ] ] +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-19.json b/src/main/resources/services/servicetest-19.json new file mode 100644 index 0000000..a707fee --- /dev/null +++ b/src/main/resources/services/servicetest-19.json @@ -0,0 +1,13 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8019\/.*", + "name": "Service Test", + "description": "Service de test pour SLO", + "id": 19, + "bypassApprovalPrompt": true, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + }, + "logoutUrl" : "http://localhost:8019/logout" +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-2.json b/src/main/resources/services/servicetest-2.json new file mode 100644 index 0000000..0e05cb8 --- /dev/null +++ b/src/main/resources/services/servicetest-2.json @@ -0,0 +1,7 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8002\/.*", + "name": "Service Test", + "description": "Service de test pour CI avec Puppeteer (redirection)", + "id": 2 +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-3.json b/src/main/resources/services/servicetest-3.json new file mode 100644 index 0000000..c40572c --- /dev/null +++ b/src/main/resources/services/servicetest-3.json @@ -0,0 +1,17 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8003\/.*", + "name": "Service Test", + "description": "Service de test pour TimeBasedRegisteredServiceAccessStrategy valide", + "id": 3, + "accessStrategy": { + "@class": "org.apereo.cas.services.TimeBasedRegisteredServiceAccessStrategy", + "startingDateTime": "2024-07-23T09:52:00.132+02:00", + "endingDateTime": "2094-07-23T10:05:00.132+02:00", + "zoneId": "UTC+2" + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-4.json b/src/main/resources/services/servicetest-4.json new file mode 100644 index 0000000..379bf69 --- /dev/null +++ b/src/main/resources/services/servicetest-4.json @@ -0,0 +1,17 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8004\/.*", + "name": "Service Test", + "description": "Service de test pour TimeBasedRegisteredServiceAccessStrategy invalide", + "id": 4, + "accessStrategy": { + "@class": "org.apereo.cas.services.TimeBasedRegisteredServiceAccessStrategy", + "startingDateTime": "2024-07-23T09:52:00.132+02:00", + "endingDateTime": "2024-07-23T10:05:00.132+02:00", + "zoneId": "UTC+2" + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-5.json b/src/main/resources/services/servicetest-5.json new file mode 100644 index 0000000..54dbac3 --- /dev/null +++ b/src/main/resources/services/servicetest-5.json @@ -0,0 +1,23 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8005\/.*", + "name": "Service Test", + "description": "Service de test pour DefaultRegisteredServiceAccessStrategy", + "id": 5, + "accessStrategy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy", + "requiredAttributes": { + "@class": "java.util.HashMap", + "ENTPersonLogin": [ + "java.util.HashSet", + [ + "test1" + ] + ] + } + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-6.json b/src/main/resources/services/servicetest-6.json new file mode 100644 index 0000000..a298e41 --- /dev/null +++ b/src/main/resources/services/servicetest-6.json @@ -0,0 +1,38 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8006\/.*", + "name": "Service Test", + "description": "Service de test pour ChainingRegisteredServiceAccessStrategy avec un OR", + "id": 6, + "accessStrategy": { + "@class": "org.apereo.cas.services.ChainingRegisteredServiceAccessStrategy", + "strategies": [ + "java.util.ArrayList", + [ + { + "@class": "org.apereo.cas.services.TimeBasedRegisteredServiceAccessStrategy", + "startingDateTime": "2024-07-23T09:52:00.132+02:00", + "endingDateTime": "2024-07-23T10:05:00.132+02:00", + "zoneId": "UTC+2" + }, + { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy", + "requiredAttributes": { + "@class": "java.util.HashMap", + "ENTPersonLogin": [ + "java.util.HashSet", + [ + "test1" + ] + ] + } + } + ] + ], + "operator": "OR" + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-7.json b/src/main/resources/services/servicetest-7.json new file mode 100644 index 0000000..3fe9f39 --- /dev/null +++ b/src/main/resources/services/servicetest-7.json @@ -0,0 +1,38 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8007\/.*", + "name": "Service Test", + "description": "Service de test pour ChainingRegisteredServiceAccessStrategy avec un AND", + "id": 7, + "accessStrategy": { + "@class": "org.apereo.cas.services.ChainingRegisteredServiceAccessStrategy", + "strategies": [ + "java.util.ArrayList", + [ + { + "@class": "org.apereo.cas.services.TimeBasedRegisteredServiceAccessStrategy", + "startingDateTime": "2024-07-23T09:52:00.132+02:00", + "endingDateTime": "2094-07-23T10:05:00.132+02:00", + "zoneId": "UTC+2" + }, + { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy", + "requiredAttributes": { + "@class": "java.util.HashMap", + "ENTPersonLogin": [ + "java.util.HashSet", + [ + "test1" + ] + ] + } + } + ] + ], + "operator": "AND" + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-8.json b/src/main/resources/services/servicetest-8.json new file mode 100644 index 0000000..e081d5d --- /dev/null +++ b/src/main/resources/services/servicetest-8.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8008\/.*", + "name": "Service Test", + "description": "Service de test pour TimeBasedRegisteredServiceAccessStrategy valide inversé", + "id": 8, + "accessStrategy": { + "@class": "org.apereo.cas.services.TimeBasedRegisteredServiceAccessStrategy", + "startingDateTime": "2024-07-23T09:52:00.132+02:00", + "endingDateTime": "2094-07-23T10:05:00.132+02:00", + "zoneId": "UTC+2", + "authorize": false + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file diff --git a/src/main/resources/services/servicetest-9.json b/src/main/resources/services/servicetest-9.json new file mode 100644 index 0000000..6fbb604 --- /dev/null +++ b/src/main/resources/services/servicetest-9.json @@ -0,0 +1,18 @@ +{ + "@class": "org.apereo.cas.services.CasRegisteredService", + "serviceId": "^http:\/\/localhost:8009\/.*", + "name": "Service Test", + "description": "Service de test pour TimeBasedRegisteredServiceAccessStrategy invalide inversé", + "id": 9, + "accessStrategy": { + "@class": "org.apereo.cas.services.TimeBasedRegisteredServiceAccessStrategy", + "startingDateTime": "2024-07-23T09:52:00.132+02:00", + "endingDateTime": "2024-07-23T10:05:00.132+02:00", + "zoneId": "UTC+2", + "authorize": false + }, + "webflowInterruptPolicy": { + "@class": "org.apereo.cas.services.DefaultRegisteredServiceWebflowInterruptPolicy", + "enabled": false + } +} \ No newline at end of file