Skip to content

Commit 9e529e9

Browse files
author
Fernando López Aguilar
committed
Resolve problem of tutorial 405 in NGSIv2
1 parent 4260b44 commit 9e529e9

15 files changed

+245
-129
lines changed

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.8

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ can take a look to this [Behave tutorial](https://jenisys.github.io/behave.examp
1717

1818
The following software must be installed:
1919

20-
- Python 3.11
21-
- pip
22-
- virtualenv
20+
- Python 3.12
21+
- uv 0.5.9
2322
- allure 2.22.0 (Optional)
2423

24+
To install uv, see the [installation documentation](https://docs.astral.sh/uv/getting-started/installation)
25+
for details and alternative installation methods.
26+
2527
To install allure on linux system you can execute the following commands:
2628

2729
```bash
@@ -31,6 +33,8 @@ sudo ln -s /opt/allure-2.22.0/bin/allure /usr/bin/allure
3133
allure --version
3234
```
3335

36+
37+
3438
## Structure of the Project
3539

3640
The structure of the project is very easy. you can take a look on the following schematic
@@ -102,9 +106,9 @@ process is only about the python dependencies, because the python code do not ne
102106
installation.
103107

104108
1. Clone this repository.
105-
2. Create the virtualenv: `virtualenv -ppython3.11 venv`.
109+
2. Create the virtualenv: `uv venv`.
106110
3. Activate the python environment: `source ./venv/bin/activate`.
107-
4. Install the requirements: `pip install -r requirements.txt`.
111+
4. Install the requirements: `; uv pip install -r requirements.txt; uv pip install -r requirements-dev.txt`.
108112
5. Add the OpenWeatherMap Key Id in the `./config/config.json` file.
109113

110114
To obtain a OpenWeather API Key, you need to register in [OpenWeather](https://openweathermap.org). There is a Free

features/405.XACML_Rules-based_Permissions.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,26 @@ Feature: Test tutorial 405.XACML Rules-based Permissions
3333
Scenario: 05 - AuthZForce - List the available revisions of a policyset
3434
When I set the "AuthZForce" a pap policy set url with the "domainId" and "policyId"
3535
And I send a GET HTTP request to that url
36-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-05.xml"
36+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-05.json"
3737

3838
Scenario: 06 - AuthZForce - Read a single version of a PolicySet
39-
When I set the "AuthZForce" to a single version of a pap policy set url with the "domainId" and "policyId"
39+
When I set the "AuthZForce" to a single version of a pap policy set url with the "domainId" and "policyId" and version 2
4040
And I send a GET HTTP request to that url
41-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-06.xml"
41+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-06.json"
4242

4343
Scenario: 07 - AuthZForce - Permit access to a resource
4444
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
4545
And I set the "Content-Type" header with the value "application/xml"
4646
And the body request described in file "request405-07.xml"
4747
And I send a POST HTTP request to that url
48-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-07.xml"
48+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-07.json"
4949

5050
Scenario: 08 - AuthZForce - Deny access to a resource
5151
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
5252
And I set the "Content-Type" header with the value "application/xml"
5353
And the body request described in file "request405-08.xml"
5454
And I send a POST HTTP request to that url
55-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-08.xml"
55+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-08.json"
5656

5757
Scenario: 09 - Keystone - User obtain an access token
5858
When I set the "Authorization" header with the value "Basic dHV0b3JpYWwtZGNrci1zaXRlLTAwMDAteHByZXNzd2ViYXBwOnR1dG9yaWFsLWRja3Itc2l0ZS0wMDAwLWNsaWVudHNlY3JldA=="
@@ -77,4 +77,4 @@ Feature: Test tutorial 405.XACML Rules-based Permissions
7777
And I set the "Content-Type" header with the value "application/xml"
7878
And the body request described in file "request405-11.xml"
7979
And I send a POST HTTP request to that url
80-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-11.xml"
80+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-11.json"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"domainId": false,
3+
"policyId": false,
4+
"revisions": [
5+
{
6+
"href": "2",
7+
"rel": "item"
8+
},
9+
{
10+
"href": "1",
11+
"rel": "item"
12+
}
13+
]
14+
}

features/data/405.XACML_Permissions/response405-05.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"id": "f8194af5-8a07-486a-9581-c1f05d05483c",
3+
"version": "2",
4+
"policyCombiningAlgId": "urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:deny-unless-permit",
5+
"description": "Policy Set for application tutorial-dckr-site-0000-xpresswebapp",
6+
"policies": [
7+
{
8+
"id": "security-role-0000-0000-000000000000",
9+
"version": "1.0",
10+
"policyCombiningAlgId": "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit",
11+
"rules": [
12+
{
13+
"id": "alrmbell-ring-0000-0000-000000000000",
14+
"effect": "Permit"
15+
},
16+
{
17+
"id": "entrance-open-0000-0000-000000000000",
18+
"effect": "Permit"
19+
},
20+
{
21+
"id": "orion-access-0000-0000-000000000000",
22+
"effect": "Permit"
23+
}
24+
],
25+
"description": "Role security-role-0000-0000-000000000000 from application tutorial-dckr-site-0000-xpresswebapp"
26+
},
27+
{
28+
"id": "managers-role-0000-0000-000000000000",
29+
"version": "1.0",
30+
"policyCombiningAlgId": "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit",
31+
"rules": [
32+
{
33+
"id": "alrmbell-ring-0000-0000-000000000000",
34+
"effect": "Permit"
35+
},
36+
{
37+
"id": "increase-stck-0000-0000-000000000000",
38+
"effect": "Permit"
39+
},
40+
{
41+
"id": "pricechg-stck-0000-0000-000000000000",
42+
"effect": "Permit"
43+
},
44+
{
45+
"id": "orion-access-0000-0000-000000000000",
46+
"effect": "Permit"
47+
}
48+
],
49+
"description": "Role managers-role-0000-0000-000000000000 from application tutorial-dckr-site-0000-xpresswebapp"
50+
}
51+
]
52+
}

features/data/405.XACML_Permissions/response405-06.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"decision": "Permit"
3+
}

features/data/405.XACML_Permissions/response405-07.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"decision": "Deny"
3+
}

0 commit comments

Comments
 (0)