-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path5.0.1.js
More file actions
78 lines (70 loc) · 2.12 KB
/
Copy path5.0.1.js
File metadata and controls
78 lines (70 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const TestIntrospectionRequest = require('../server/lib/test/TestIntrospectionRequest.js');
const moment = require('../server/node_modules/moment');
class Test_5_0_1 extends TestIntrospectionRequest {
constructor(
metadata,
authrequest,
authresponse,
tokenrequest,
tokenresponse,
refreshtokenrequest,
refreshtokenresponse,
userinforequest,
userinforesponse,
introspectionrequest,
introspectionresponse
) {
super(
metadata,
authrequest,
authresponse,
tokenrequest,
tokenresponse,
refreshtokenrequest,
refreshtokenresponse,
userinforequest,
userinforesponse,
introspectionrequest,
introspectionresponse
);
this.num = '5.0.1';
this.description = 'request correct, token expired';
this.validation = 'self';
}
async exec() {
this.introspectionrequest.client_id = config_rp.client_id;
this.introspectionrequest.code = this.authresponse.code;
this.introspectionrequest.code_verifier = this.authrequest.code_verifier;
this.introspectionrequest.grant_type = 'authorization_code';
this.introspectionrequest.client_assertion_type =
'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
this.introspectionrequest.redirect_uri = this.authrequest.redirect_uri;
const config_key = fs.readFileSync(
path.resolve(__dirname, '../config/spid-oidc-check-op-sig.key')
);
const keystore = jose.JWK.createKeyStore();
let key = await keystore.add(config_key, 'pem');
let header = {};
let iat = moment();
let exp = iat.clone().add(15, 'm');
let payload = JSON.stringify({
jti: Utility.getUUID(),
iss: this.introspectionrequest.client_id,
aud: this.metadata.configuration.introspection_endpoint,
iat: iat.unix(),
exp: exp.unix(),
sub: this.introspectionrequest.client_id,
});
this.introspectionrequest.client_assertion = await jose.JWS.createSign(
{
format: 'compact',
alg: 'RS256',
fields: { ...header },
},
key
)
.update(payload)
.final();
}
}
module.exports = Test_5_0_1;