Skip to content

Commit b28fa68

Browse files
author
Fernando López Aguilar
committed
Resolve problems with XML in tutorial 405 and 406
1 parent 9e529e9 commit b28fa68

29 files changed

+137
-149
lines changed

features/405.XACML_Rules-based_Permissions.feature

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Feature: Test tutorial 405.XACML Rules-based Permissions
2+
23
This is feature file of the FIWARE step by step tutorial for XACML rules-based permissions
34
url: https://fiware-tutorials.readthedocs.io/en/latest/xacml-access-rules.html
45
git-clone: https://github.com/FIWARE/tutorials.XACML-Access-Rules.git
@@ -21,16 +22,16 @@ Feature: Test tutorial 405.XACML Rules-based Permissions
2122
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-02.json"
2223

2324
Scenario: 03 - AuthZForce - Read a single domain
24-
When I set the "AuthZForce" domains url with the "domainId"
25+
When I set the "AuthZForce" domains url with the previous "domainId"
2526
And I send a GET HTTP request to that url
2627
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-03.json"
2728

2829
Scenario: 04 - AuthZForce - List all PolicySets available within a domain
29-
When I set the "AuthZForce" pap policies url with the "domainId"
30+
When I set the "AuthZForce" pap policies url with the previous "domainId"
3031
And I send a GET HTTP request to that url
3132
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-04.json"
3233

33-
Scenario: 05 - AuthZForce - List the available revisions of a policyset
34+
Scenario: 05 - AuthZForce - List the available revisions of a PolicySet
3435
When I set the "AuthZForce" a pap policy set url with the "domainId" and "policyId"
3536
And I send a GET HTTP request to that url
3637
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-05.json"
@@ -41,19 +42,20 @@ Feature: Test tutorial 405.XACML Rules-based Permissions
4142
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-06.json"
4243

4344
Scenario: 07 - AuthZForce - Permit access to a resource
44-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
45+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
4546
And I set the "Content-Type" header with the value "application/xml"
4647
And the body request described in file "request405-07.xml"
4748
And I send a POST HTTP request to that url
4849
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-07.json"
4950

5051
Scenario: 08 - AuthZForce - Deny access to a resource
51-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
52+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
5253
And I set the "Content-Type" header with the value "application/xml"
5354
And the body request described in file "request405-08.xml"
5455
And I send a POST HTTP request to that url
5556
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response405-08.json"
5657

58+
# Assertion Failed: The token_type received is not the expected value, received: bearer, but was expected Bearer
5759
Scenario: 09 - Keystone - User obtain an access token
5860
When I set the "Authorization" header with the value "Basic dHV0b3JpYWwtZGNrci1zaXRlLTAwMDAteHByZXNzd2ViYXBwOnR1dG9yaWFsLWRja3Itc2l0ZS0wMDAwLWNsaWVudHNlY3JldA=="
5961
And I set the "Content-Type" header with the value "application/x-www-form-urlencoded"
@@ -65,6 +67,7 @@ Feature: Test tutorial 405.XACML Rules-based Permissions
6567
| access_token | token_type | scope |
6668
| any | Bearer | ["permanent"] |
6769

70+
# The result obtained is obsolete, there are changes in idm
6871
Scenario: 10 - Keystone - Obtain roles and domain
6972
When I set the user url to obtain roles and domain with the following data
7073
| access_token | app_id |
@@ -73,7 +76,7 @@ Feature: Test tutorial 405.XACML Rules-based Permissions
7376
Then I receive a HTTP "200" response code from Keyrock with the body equal to "response405-10.json"
7477

7578
Scenario: 11 - AuthZForce - Apply a policy to a request
76-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
79+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
7780
And I set the "Content-Type" header with the value "application/xml"
7881
And the body request described in file "request405-11.xml"
7982
And I send a POST HTTP request to that url
Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Feature: Test tutorial 406.Administrating_XACML_Rules
2+
23
This is feature file of the FIWARE step by step tutorial for Administrating XACML rules
34
url: https://fiware-tutorials.readthedocs.io/en/latest/administrating-xacml.html
45
git-clone: https://github.com/FIWARE/tutorials.Administrating-XACML.git
@@ -10,75 +11,75 @@ Feature: Test tutorial 406.Administrating_XACML_Rules
1011
Given I set the tutorial 406
1112

1213
Scenario: 01 - Creating a new domain
13-
When I set the url to "http://localhost:8080/authzforce-ce/domains"
14+
When I set the "AuthZForce" to the domain url
1415
And I set the "Content-Type" header with the value "application/xml"
1516
And the body request described in file "request406-01.xml"
1617
And I send a POST HTTP request to that url
17-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-01.xml"
18+
Then I receive a HTTP "200" response code from AuthZForce with the body containing a href attribute
1819

1920
Scenario: 02 - Request a decision from AuthZForce
20-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
21+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
2122
And I set the "Content-Type" header with the value "application/xml"
2223
And the body request described in file "request406-02.xml"
2324
And I send a POST HTTP request to that url
24-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-02.xml"
25+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-02.json"
2526

2627
Scenario: 03 - Creating an initial policy set
27-
When I set the "AuthZForce" pap policies url with the "domainId"
28+
When I set the "AuthZForce" pap policies url with the previous "domainId"
2829
And I set the "Content-Type" header with the value "application/xml"
2930
And the body request described in file "request406-03.xml"
3031
And I send a POST HTTP request to that url
31-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-03.xml"
32+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-03.json"
3233

3334
Scenario: 04 - Activating the initial policy set
34-
When I set the "AuthZForce" pap policies with pdp.properties url with the "domainId"
35+
When I set the "AuthZForce" pap policies with pdp.properties url with the previous "domainId"
3536
And I set the "Content-Type" header with the value "application/xml"
3637
And the body request described in file "request406-04.xml"
3738
And I send a PUT HTTP request to that url
38-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-04.xml"
39+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-04.json"
3940

4041
Scenario: 05 - Request to access to loading in the white zone
41-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
42+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
4243
And I set the "Content-Type" header with the value "application/xml"
4344
And the body request described in file "request406-05.xml"
4445
And I send a POST HTTP request to that url
45-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-05.xml"
46+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-05.json"
4647

4748
Scenario: 06 - Request to access to loading in the red zone
48-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
49+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
4950
And I set the "Content-Type" header with the value "application/xml"
5051
And the body request described in file "request406-06.xml"
5152
And I send a POST HTTP request to that url
52-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-06.xml"
53+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-06.json"
5354

5455
Scenario: 07 - Updating a policy set
55-
When I set the "AuthZForce" pap policies url with the "domainId"
56+
When I set the "AuthZForce" pap policies url with the previous "domainId"
5657
And I set the "Content-Type" header with the value "application/xml"
5758
And the body request described in file "request406-07.xml"
5859
And I send a POST HTTP request to that url
59-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-07.xml"
60+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-07.json"
6061

6162

6263
Scenario: 08 - Activating an updated policy set
63-
When I set the "AuthZForce" pap policies with pdp.properties url with the "domainId"
64+
When I set the "AuthZForce" pap policies with pdp.properties url with the previous "domainId"
6465
And I set the "Content-Type" header with the value "application/xml"
6566
And the body request described in file "request406-08.xml"
6667
And I send a PUT HTTP request to that url
67-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-08.xml"
68+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-08.json"
6869

6970
Scenario: 09 - Request to access to loading in the white zone again
70-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
71+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
7172
And I set the "Content-Type" header with the value "application/xml"
7273
And the body request described in file "request406-09.xml"
7374
And I send a POST HTTP request to that url
74-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-09.xml"
75+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-09.json"
7576

7677
Scenario: 10 - Request to access to loading in the red zone again
77-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
78+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
7879
And I set the "Content-Type" header with the value "application/xml"
7980
And the body request described in file "request406-10.xml"
8081
And I send a POST HTTP request to that url
81-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-10.xml"
82+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-10.json"
8283

8384
Scenario: 11 - Create a token with password
8485
When I define the body request described in file "request406-11.json"
@@ -89,13 +90,15 @@ Feature: Test tutorial 406.Administrating_XACML_Rules
8990
| Status-Code | X-Subject-Token | Connection | data | excluded |
9091
| 201 | any | keep-alive | response406-11.json | response406-11.excludes |
9192

93+
# The result obtained is obsolete, there are changes in idm
9294
Scenario: 12 - Read a Verb-resource permission
9395
When I set the "Content-Type" header with the value "application/json"
9496
And I set the "X-Auth-token" header with the value "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
9597
And I set the url to "http://localhost:3005/v1/applications/tutorial-dckr-site-0000-xpresswebapp/permissions/entrance-open-0000-0000-000000000000"
9698
And I send a GET HTTP request to that url
9799
Then I receive a HTTP "200" response code from Keystone with the body equal to "response406-12.json"
98100

101+
# The result obtained is obsolete, there are changes in idm
99102
Scenario: 13 - Read a XACML rule permission
100103
When I set the "Content-Type" header with the value "application/json"
101104
And I set the "X-Auth-token" header with the value "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
@@ -104,12 +107,13 @@ Feature: Test tutorial 406.Administrating_XACML_Rules
104107
Then I receive a HTTP "200" response code from Keystone with the body equal to "response406-13.json"
105108

106109
Scenario: 14 - Deny access to a resource
107-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
110+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
108111
And I set the "Content-Type" header with the value "application/xml"
109112
And the body request described in file "request406-14.xml"
110113
And I send a POST HTTP request to that url
111-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-14.xml"
114+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-14.json"
112115

116+
# {"error":{"message":"if use_authorization_service_header is set, authorization_service_header needs to be set","code":400,"title":"Bad Request"}}
113117
Scenario: 15 - Update an XACML permission
114118
When I set the "Content-Type" header with the value "application/json"
115119
And I set the "X-Auth-token" header with the value "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
@@ -125,6 +129,7 @@ Feature: Test tutorial 406.Administrating_XACML_Rules
125129
And I send a DELETE HTTP request to that url
126130
Then I receive a HTTP "204" status code response
127131

132+
# Internal server error: 500
128133
Scenario: 17 - Passing the updated policy set to AuthZForce, recreating the policy set
129134
When I set the "Content-Type" header with the value "application/json"
130135
And I set the "X-Auth-token" header with the value "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
@@ -133,9 +138,10 @@ Feature: Test tutorial 406.Administrating_XACML_Rules
133138
And I send a POST HTTP request to that url
134139
Then I receive a HTTP "201" response code from Keystone with the body equal to "response406-17.json"
135140

141+
# Decision Deny...
136142
Scenario: 18 - Permit access to a resource
137-
When I set the "AuthZForce" to the pdp endpoint url with the "domainId"
143+
When I set the "AuthZForce" to the pdp endpoint url with the previous "domainId"
138144
And I set the "Content-Type" header with the value "application/xml"
139145
And the body request described in file "request406-18.xml"
140146
And I send a POST HTTP request to that url
141-
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-18.xml"
147+
Then I receive a HTTP "200" response code from AuthZForce with the body equal to "response406-18.json"

features/data/406.Administrating_XACML_Rules/request406-15.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"permission": {
33
"action": "",
44
"resource": "",
5-
"xml": "<Rule RuleId=\"alrmbell-ring-only-000000000000\" Effect=\"Permit\"> etc..."
5+
"use_authorization_service_header" : false,
6+
"xml": "<Rule RuleId=\"alrmbell-ring-only-000000000000\" Effect=\"Permit\">\n<Description>Allow Full Access to Charlie the Security Manager</Description>\n<Target>\n<AnyOf>\n<AllOf>\n<Match MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/bell/ring</AttributeValue>\n<AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:thales:xacml:2.0:resource:sub-resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"true\" />\n</Match>\n</AllOf>\n</AnyOf>\n<AnyOf>\n<AllOf>\n<Match MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">POST</AttributeValue>\n<AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"true\" />\n</Match>\n</AllOf>\n</AnyOf>\n<AnyOf>\n<AllOf>\n<Match MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">charlie</AttributeValue>\n<AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:subject:subject-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"true\" />\n</Match>\n</AllOf>\n</AnyOf>\n</Target>\n</Rule>\n<Rule RuleId=\"alrmbell-ring-24hr-hours-000000000000\" Effect=\"Permit\">\n<Description>Ring Alarm Bell (Outside Core Hours)</Description>\n<Target>\n<AnyOf>\n<AllOf>\n<Match MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/bell/ring</AttributeValue>\n<AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:thales:xacml:2.0:resource:sub-resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"true\" />\n</Match>\n</AllOf>\n</AnyOf>\n<AnyOf>\n<AllOf>\n<Match MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">POST</AttributeValue>\n<AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"true\" />\n</Match>\n</AllOf>\n</AnyOf>\n<AnyOf>\n<AllOf>\n<Match MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">security-role-0000-0000-000000000000</AttributeValue>\n<AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"urn:oasis:names:tc:xacml:2.0:subject:role\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"true\" />\n</Match>\n</AllOf>\n</AnyOf>\n</Target>\n<Condition>\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:1.0:function:not\">\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:2.0:function:time-in-range\">\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:1.0:function:time-one-and-only\">\n<AttributeDesignator AttributeId=\"urn:oasis:names:tc:xacml:1.0:environment:current-time\" DataType=\"http://www.w3.org/2001/XMLSchema#time\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:environment\" MustBePresent=\"false\"></AttributeDesignator>\n</Apply>\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:1.0:function:time-one-and-only\">\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:1.0:function:time-bag\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#time\">08:00:00</AttributeValue>\n</Apply>\n</Apply>\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:1.0:function:time-one-and-only\">\n<Apply FunctionId=\"urn:oasis:names:tc:xacml:1.0:function:time-bag\">\n<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#time\">17:00:00</AttributeValue>\n</Apply>\n</Apply>\n</Apply>\n</Apply>\n</Condition>\n</Rule>"
67
}
78
}

features/data/406.Administrating_XACML_Rules/response406-01.xml

Lines changed: 0 additions & 2 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/406.Administrating_XACML_Rules/response406-02.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)