Skip to content

Commit d956ed3

Browse files
committed
Update to work with Config-Service 3.2.x
1 parent eff4458 commit d956ed3

File tree

7 files changed

+579
-20
lines changed

7 files changed

+579
-20
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ MYSQL_DB_VERSION=8.1
4343
# Trusted Issuers List Variables
4444
TRUSTED_ISSUERS_VERSION=0.2.1
4545
# Credentials Config Service Variables
46-
CONFIG_SERVICE_VERSION=2.0.0-PRE-8
46+
CONFIG_SERVICE_VERSION=3.2.3

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -700,19 +700,32 @@ curl -L 'localhost:8081/service/vet'
700700
"id": "vet",
701701
"defaultOidcScope": "default",
702702
"oidcScopes": {
703-
"default": [
704-
{
705-
"type": "VerifiableCredential",
706-
"trustedParticipantsLists": [],
707-
"trustedIssuersLists": [
708-
"http://trusted-issuers-list:8080"
709-
],
710-
"holderVerification": {
711-
"enabled": false,
712-
"claim": "subject"
703+
"default": {
704+
"credentials": [
705+
{
706+
"type": "VerifiableCredential",
707+
"trustedParticipantsLists": [],
708+
"trustedIssuersLists": [
709+
"http://trusted-issuers-list:8080"
710+
],
711+
"holderVerification": {
712+
"enabled": false,
713+
"claim": "subject"
714+
},
715+
"requireCompliance": false,
716+
"jwtInclusion": {
717+
"enabled": true,
718+
"fullInclusion": false,
719+
"claimsToInclude": []
720+
}
713721
}
714-
}
715-
]
722+
],
723+
"presentationDefinition": {
724+
"id": null,
725+
"input_descriptors": null
726+
},
727+
"flatClaims": false
728+
}
716729
}
717730
}
718731
```

docker-compose/common.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ services:
6868
test: ["CMD","mongosh", "localhost:27017/test", "--quiet"]
6969
interval: 5s
7070

71+
# Obtain a dump using:
72+
# docker exec db-mysql-config /usr/bin/mysqldump --user=root --password=root db > theirs.sql
7173
mysql-config-db:
7274
labels:
7375
org.fiware: 'tutorial'
@@ -231,6 +233,14 @@ services:
231233
ports:
232234
- "${IOTA_NORTH_PORT}:${IOTA_NORTH_PORT}" # localhost:4041
233235
- "${IOTA_SOUTH_PORT}:${IOTA_SOUTH_PORT}" # localhost:7896
236+
deploy:
237+
resources:
238+
limits:
239+
memory: 512M
240+
cpus: '1.0'
241+
reservations:
242+
memory: 256M
243+
cpus: '0.5'
234244
environment:
235245
- IOTA_NORTH_PORT=${IOTA_NORTH_PORT}
236246
- IOTA_REGISTRY_TYPE=mongodb #Whether to hold IoT device info in memory or in a database

link-devices

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
#
3+
# curl commands to reload the data from the previous tutorial
4+
#
5+
#
6+
7+
set -e
8+
echo
9+
printf "⏳ Link Devices to Animal entities"
10+
11+
12+
generate_post_data()
13+
{
14+
cat <<EOF
15+
$devices
16+
EOF
17+
}
18+
19+
20+
# Associate 100 cow collar Devices to Animal entities
21+
22+
devices="{\"devices\":[";
23+
for number in 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100
24+
do
25+
26+
devices="$devices {\"device_id\":\"cow$number\", \"entity_type\": \"Device\" , \"entity_name\": \"urn:ngsi-ld:Device:cow$number\", \"apikey\": \"98699\",";
27+
devices="$devices \"static_attributes\": [
28+
{
29+
\"name\": \"controlledAsset\",
30+
\"type\": \"Relationship\", \"link\": {
31+
\"attributes\": [\"heartRate\", \"location\"],
32+
\"name\": \"providedBy\",
33+
\"type\": \"Animal\"
34+
},
35+
\"value\": \"urn:ngsi-ld:Animal:cow$number\"}]}";
36+
37+
if [ $number == '100' ]
38+
then
39+
devices="$devices]}";
40+
else
41+
devices="$devices,";
42+
fi
43+
done
44+
45+
curl -s -o /dev/null -X POST \
46+
'http://iot-agent:4041/iot/devices' \
47+
-H 'Content-Type: application/json' \
48+
-H 'fiware-service: openiot' \
49+
-H 'fiware-servicepath: /' \
50+
-d "$(generate_post_data)"
51+
52+
# Associate 100 pig collar Devices to Animal entities
53+
54+
devices="{\"devices\":[";
55+
for number in 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100
56+
do
57+
58+
devices="$devices {\"device_id\":\"pig$number\", \"entity_type\": \"Device\" , \"entity_name\": \"urn:ngsi-ld:Device:pig$number\", \"apikey\": \"110990\",";
59+
devices="$devices \"static_attributes\": [
60+
{
61+
\"name\": \"controlledAsset\",
62+
\"type\": \"Relationship\", \"link\": {
63+
\"attributes\": [\"heartRate\", \"location\"],
64+
\"name\": \"providedBy\",
65+
\"type\": \"Animal\"
66+
},
67+
\"value\": \"urn:ngsi-ld:Animal:pig$number\"}]}";
68+
69+
if [ $number == '100' ]
70+
then
71+
devices="$devices]}";
72+
else
73+
devices="$devices,";
74+
fi
75+
done
76+
77+
curl -s -o /dev/null -X POST \
78+
'http://iot-agent:4041/iot/devices' \
79+
-H 'Content-Type: application/json' \
80+
-H 'fiware-service: openiot' \
81+
-H 'fiware-servicepath: /' \
82+
-d "$(generate_post_data)"
83+
84+
echo -e " \033[1;32mdone\033[0m"

mysql-data/backup.sql

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
--
33
-- Host: localhost Database: db
44
-- ------------------------------------------------------
5-
-- Server version 8.1.0
5+
-- Server version 8.1.0
66

77
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
88
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -44,10 +44,38 @@ CREATE TABLE `flyway_schema_history` (
4444

4545
LOCK TABLES `flyway_schema_history` WRITE;
4646
/*!40000 ALTER TABLE `flyway_schema_history` DISABLE KEYS */;
47-
INSERT INTO `flyway_schema_history` VALUES (1,'0.0.1','initial-migration','SQL','V0_0_1__initial-migration.sql',-1767291177,'user','2025-02-19 11:58:53',82,1),(2,'1.0.2','minimal table','SQL','V1_0_2__minimal_table.sql',-454303568,'user','2025-02-19 11:58:53',54,1);
47+
INSERT INTO `flyway_schema_history` VALUES (1,'0.0.1','initial-migration','SQL','V0_0_1__initial-migration.sql',-1767291177,'user','2025-08-13 14:51:32',92,1),(2,'1.0.2','minimal table','SQL','V1_0_2__minimal_table.sql',-454303568,'user','2025-08-13 14:51:32',73,1),(3,'2.0.0','clean tables','SQL','V2_0_0__clean_tables.sql',-1059881192,'user','2025-08-13 14:51:32',81,1),(4,'2.0.1','add flat claim flag','SQL','V2_0_1__add_flat_claim_flag.sql',485455161,'user','2025-08-13 14:51:32',19,1);
4848
/*!40000 ALTER TABLE `flyway_schema_history` ENABLE KEYS */;
4949
UNLOCK TABLES;
5050

51+
--
52+
-- Table structure for table `scope_entry`
53+
--
54+
55+
DROP TABLE IF EXISTS `scope_entry`;
56+
/*!40101 SET @saved_cs_client = @@character_set_client */;
57+
/*!50503 SET character_set_client = utf8mb4 */;
58+
CREATE TABLE `scope_entry` (
59+
`id` bigint NOT NULL AUTO_INCREMENT,
60+
`service_id` varchar(255) DEFAULT NULL,
61+
`scope_key` varchar(255) DEFAULT NULL,
62+
`credentials` longtext NOT NULL,
63+
`presentation_definition` longtext NOT NULL,
64+
`flat_claims` tinyint(1) NOT NULL,
65+
PRIMARY KEY (`id`)
66+
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
67+
/*!40101 SET character_set_client = @saved_cs_client */;
68+
69+
--
70+
-- Dumping data for table `scope_entry`
71+
--
72+
73+
LOCK TABLES `scope_entry` WRITE;
74+
/*!40000 ALTER TABLE `scope_entry` DISABLE KEYS */;
75+
INSERT INTO `scope_entry` VALUES (1,'vet','default','[{\"credentialType\":\"VerifiableCredential\",\"verifyHolder\":false,\"requireCompliance\":false,\"jwtInclusion\":{\"enabled\":true,\"fullInclusion\":false},\"holderClaim\":\"subject\",\"trustedLists\":[{\"type\":\"TRUSTED_ISSUERS\",\"listType\":\"ebsi\",\"endpoint\":\"http://trusted-issuers-list:8080\"}]}]','{}',0);
76+
/*!40000 ALTER TABLE `scope_entry` ENABLE KEYS */;
77+
UNLOCK TABLES;
78+
5179
--
5280
-- Table structure for table `service`
5381
--
@@ -57,8 +85,7 @@ DROP TABLE IF EXISTS `service`;
5785
/*!50503 SET character_set_client = utf8mb4 */;
5886
CREATE TABLE `service` (
5987
`id` varchar(255) NOT NULL,
60-
`default_oidc_scope` varchar(255) NOT NULL,
61-
`oidc_scopes` longtext NOT NULL,
88+
`default_oidc_scope` varchar(255) DEFAULT NULL,
6289
PRIMARY KEY (`id`)
6390
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
6491
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -69,7 +96,7 @@ CREATE TABLE `service` (
6996

7097
LOCK TABLES `service` WRITE;
7198
/*!40000 ALTER TABLE `service` DISABLE KEYS */;
72-
INSERT INTO `service` VALUES ('vet','default','{\"default\":[{\"credentialType\":\"VerifiableCredential\",\"trustedLists\":[{\"type\":\"TRUSTED_ISSUERS\",\"listType\":\"EBSI\",\"endpoint\":\"http://trusted-issuers-list:8080\"}],\"verifyHolder\":false,\"holderClaim\":\"subject\"}]}');
99+
INSERT INTO `service` VALUES ('vet','default');
73100
/*!40000 ALTER TABLE `service` ENABLE KEYS */;
74101
UNLOCK TABLES;
75102
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -82,4 +109,4 @@ UNLOCK TABLES;
82109
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
83110
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
84111

85-
-- Dump completed on 2025-02-19 13:12:29
112+
-- Dump completed on 2025-08-13 15:10:13

0 commit comments

Comments
 (0)