-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
fixtures.js
68 lines (50 loc) · 1.25 KB
/
fixtures.js
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
/**
* Module dependencies.
*/
import { readFile } from 'node:fs/promises';
/**
* Samples
*/
/**
* SAML response with a single role ARN.
*/
const SAML_SESSION_BASIC = 'saml-session-basic';
/**
* SAML response with a single AWS GovCloud (US) role ARN.
*/
const SAML_SESSION_BASIC_GOV_CLOUD_US = 'saml-session-basic-gov-cloud-us';
/**
* SAML response with a single AWS China role ARN.
*/
const SAML_SESSION_BASIC_CN = 'saml-session-basic-cn';
/**
* SAML response with a custom session duration parameter.
*/
const SAML_SESSION_BASIC_WITH_SESSION_DURATION = 'saml-session-basic-with-session-duration';
/**
* SAML response with multiple roles.
*/
const SAML_SESSION_BASIC_WITH_MULTIPLE_ROLES = 'saml-session-basic-with-multiple-roles';
/**
* Test helpers.
*/
async function getResponseFromAssertion(assertion) {
return {
SAMLResponse: assertion
};
}
async function getSampleAssertion(name) {
return Buffer.from(await readFile(`fixtures/${name}.xml`, 'utf-8'), 'ascii').toString('base64')
}
/**
* Exports.
*/
export {
SAML_SESSION_BASIC,
SAML_SESSION_BASIC_GOV_CLOUD_US,
SAML_SESSION_BASIC_CN,
SAML_SESSION_BASIC_WITH_SESSION_DURATION,
SAML_SESSION_BASIC_WITH_MULTIPLE_ROLES,
getResponseFromAssertion,
getSampleAssertion
};