Skip to content

Commit 2e69774

Browse files
authored
Test environment compliance
Test environment compliance
2 parents 14731e0 + cf57758 commit 2e69774

8 files changed

Lines changed: 34 additions & 20 deletions

File tree

src/config_sample/rp.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"autoLogin": true,
1717

18+
"trust_anchor": "https://registry-test.spid.gov.it",
1819
"authority_hints": [
1920
"https://registry.spid.gov.it"
2021
],

src/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "spid-oidc-check-op",
3-
"version": "1.15.1",
3+
"version": "1.15.2",
44
"description": "SPID OIDC Conformance Test Tool for OP",
55
"main": "spid-oidc-check-op",
66
"author": "Michele D'Amico (damikael) - AgID",

src/test/1.2.14.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Test_1_2_14 extends TestMetadata {
66
super(metadata);
77
this.num = '1.2.14';
88
this.description =
9-
"The authority_hints MUST contain 'https://registry.spid.gov.it'";
9+
"The authority_hints MUST contain 'https://registry.spid.gov.it' and 'https://registry-test.spid.gov.it'";
1010
this.validation = 'automatic';
1111
}
1212

@@ -17,9 +17,17 @@ class Test_1_2_14 extends TestMetadata {
1717
return false;
1818
}
1919

20-
this.notes = jwt_decode(this.metadata.entity_statement).authority_hints;
21-
if (!this.notes.includes('https://registry.spid.gov.it'))
22-
throw "'https://registry.spid.gov.it' is not present in authority_hints";
20+
let authority_hints = jwt_decode(this.metadata.entity_statement).authority_hints;
21+
this.notes = authority_hints;
22+
23+
if(!(authority_hints.includes('https://registry.spid.gov.it') && authority_hints.includes('https://registry-test.spid.gov.it'))) {
24+
if(!authority_hints.includes('https://registry.spid.gov.it')) {
25+
throw "'https://registry.spid.gov.it' is not present in authority_hints";
26+
}
27+
if(!authority_hints.includes('https://registry-test.spid.gov.it')) {
28+
throw "'https://registry-test.spid.gov.it' is not present in authority_hints";
29+
}
30+
}
2331

2432
return true;
2533
}

src/test/1.2.28.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const TestMetadata = require('../server/lib/test/TestMetadata.js');
22
const jwt_decode = require('../server/node_modules/jwt-decode');
33
const validator = require('../server/node_modules/validator');
4+
const config_rp = require('../config/rp.json');
45

56
class Test_1_2_28 extends TestMetadata {
67
constructor(metadata) {
78
super(metadata);
89
this.num = '1.2.28';
9-
this.description = 'The trust_marks array MUST contain a TM of role OP';
10+
this.description = 'The trust_marks array MUST contain a TM of role OP private';
1011
this.validation = 'automatic';
1112
}
1213

@@ -32,7 +33,7 @@ class Test_1_2_28 extends TestMetadata {
3233
let valid = false;
3334

3435
for(let tm of entity_statement.trust_marks) {
35-
valid = valid || (tm.id=='https://registry.spid.gov.it/openid_provider/');
36+
valid = valid || (tm.id==config_rp.trust_anchor + '/openid_provider/private/');
3637
}
3738

3839
if(!valid) {

src/test/1.2.29.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const validator = require("../server/node_modules/validator");
44
const axios = require("../server/node_modules/axios").default;
55
const jose = require("../server/node_modules/node-jose");
66
const fs = require("fs");
7+
const config_rp = require('../config/rp.json');
78
const private_key = fs.readFileSync(
89
__dirname + "/../config/spid-oidc-check-op-enc.key",
910
"utf8"
@@ -28,7 +29,7 @@ class Test_1_2_29 extends TestMetadata {
2829
let registry_jwks = null;
2930

3031
// get jwk from registry
31-
let registry_entity_statement = (await axios.get('https://registry.spid.gov.it/.well-known/openid-federation')).data;
32+
let registry_entity_statement = (await axios.get(config_rp.trust_anchor + '/.well-known/openid-federation')).data;
3233
let registry_config = jwt_decode(registry_entity_statement);
3334

3435
registry_jwks = registry_config.jwks;
@@ -45,7 +46,7 @@ class Test_1_2_29 extends TestMetadata {
4546
let entity_statement = jwt_decode(this.metadata.entity_statement);
4647

4748
for(let tm of entity_statement.trust_marks) {
48-
if(tm.id=='https://registry.spid.gov.it/openid_provider/') {
49+
if(tm.id==config_rp.trust_anchor + '/openid_provider/private/') {
4950

5051
let result = await jose.JWS.createVerify(keystore).verify(tm.trust_mark)
5152
this.notes = result;

src/test/1.7.0.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const TestMetadata = require('../server/lib/test/TestMetadata.js');
22
const jwt_decode = require('../server/node_modules/jwt-decode');
33
const validator = require('../server/node_modules/validator');
4+
const config_rp = require('../config/rp.json');
45

56
class Test_1_7_0 extends TestMetadata {
67
constructor(metadata) {
78
super(metadata);
89
this.num = '1.7.0';
9-
this.description = 'The value of claim id inside the TM with role OP MUST be equal to the value of claim id of related TM into EC';
10+
this.description = 'The value of claim id inside the TM with role OP private MUST be equal to the value of claim id of related TM into EC';
1011
this.validation = 'automatic';
1112
}
1213

@@ -32,19 +33,19 @@ class Test_1_7_0 extends TestMetadata {
3233
let tm_jwt = null;
3334

3435
for(let ec_tm of entity_statement.trust_marks) {
35-
if (ec_tm.id=='https://registry.spid.gov.it/openid_provider/') tm_jwt = ec_tm.trust_mark;
36+
if (ec_tm.id==config_rp.trust_anchor + '/openid_provider/private/') tm_jwt = ec_tm.trust_mark;
3637
}
3738

3839
if(tm_jwt==null) {
3940
this.notes = entity_statement.trust_marks;
40-
throw 'The trust_marks array does not contain any TM of role OP';
41+
throw 'The trust_marks array does not contain any TM of role OP private';
4142
}
4243

4344
let tm = jwt_decode(tm_jwt);
4445

45-
if(tm.id!='https://registry.spid.gov.it/openid_provider/') {
46+
if(tm.id!=config_rp.trust_anchor + '/openid_provider/private/') {
4647
this.notes = tm.id;
47-
throw 'The value of claim id inside TM of role OP is not equal to https://registry.spid.gov.it/openid_provider/';
48+
throw 'The value of claim id inside TM of role OP private is not equal to ' + config_rp.trust_anchor + '/openid_provider/private/';
4849
}
4950

5051
this.notes = tm;

src/test/1.7.1.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const TestMetadata = require('../server/lib/test/TestMetadata.js');
22
const jwt_decode = require('../server/node_modules/jwt-decode');
33
const validator = require('../server/node_modules/validator');
4+
const config_rp = require('../config/rp.json');
45

56
class Test_1_7_1 extends TestMetadata {
67
constructor(metadata) {
78
super(metadata);
89
this.num = '1.7.1';
9-
this.description = 'The value of claim sub inside the TM with role OP MUST be equal to the value of claim sub into EC';
10+
this.description = 'The value of claim sub inside the TM with role OP private MUST be equal to the value of claim sub into EC';
1011
this.validation = 'automatic';
1112
}
1213

@@ -32,7 +33,7 @@ class Test_1_7_1 extends TestMetadata {
3233
let tm_jwt = null;
3334

3435
for(let ec_tm of entity_statement.trust_marks) {
35-
if (ec_tm.id=='https://registry.spid.gov.it/openid_provider/') tm_jwt = ec_tm.trust_mark;
36+
if (ec_tm.id==config_rp.trust_anchor + '/openid_provider/private/') tm_jwt = ec_tm.trust_mark;
3637
}
3738

3839
if(tm_jwt==null) {

src/test/1.7.2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const TestMetadata = require('../server/lib/test/TestMetadata.js');
22
const jwt_decode = require('../server/node_modules/jwt-decode');
33
const validator = require('../server/node_modules/validator');
4+
const config_rp = require('../config/rp.json');
45

56
class Test_1_7_2 extends TestMetadata {
67
constructor(metadata) {
78
super(metadata);
89
this.num = '1.7.2';
9-
this.description = 'The value of iss inside the TM with role OP MUST be equal to https://registry.spid.gov.it';
10+
this.description = 'The value of iss inside the TM with role OP private MUST be equal to ' + config_rp.trust_anchor;
1011
this.validation = 'automatic';
1112
}
1213

@@ -32,7 +33,7 @@ class Test_1_7_2 extends TestMetadata {
3233
let tm_jwt = null;
3334

3435
for(let ec_tm of entity_statement.trust_marks) {
35-
if (ec_tm.id=='https://registry.spid.gov.it/openid_provider/') tm_jwt = ec_tm.trust_mark;
36+
if (ec_tm.id==config_rp.trust_anchor + '/openid_provider/private/') tm_jwt = ec_tm.trust_mark;
3637
}
3738

3839
if(tm_jwt==null) {
@@ -42,9 +43,9 @@ class Test_1_7_2 extends TestMetadata {
4243

4344
let tm = jwt_decode(tm_jwt);
4445

45-
if(tm.iss!='https://registry.spid.gov.it') {
46+
if(tm.iss!=config_rp.trust_anchor) {
4647
this.notes = tm.iss;
47-
throw 'The value of claim iss inside TM of role OP is not equal to https://registry.spid.gov.it';
48+
throw 'The value of claim iss inside TM of role OP is not equal to ' + config_rp.trust_anchor;
4849
}
4950

5051
this.notes = tm;

0 commit comments

Comments
 (0)