/
index.js
62 lines (61 loc) · 1.63 KB
/
index.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
const {create} = require('fake-sso-idp');
const app = create({
serviceProvider: {
metadata: process.env.SAML_METADATA,
destination: process.env.SAML_DESTINATION,
forceAuthentication: true,
},
users: [
{
id: 'test1',
name: 'susan@email.com',
username: 'test1',
password: 'pwd',
attributes: {
emailAddress: {
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
value: 'susan@email.com',
type: 'xs:string',
},
firstName: {
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
value: 'Sue',
type: 'xs:string',
},
lastName: {
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
value: 'Sueson',
type: 'xs:string',
},
role: {
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
value: 'associate',
type: 'xs:string',
},
employeeIdentifier: {
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
value: 'employee-666',
type: 'xs:string',
},
},
},
{
id: 'fubar',
name: 'Test user 2',
username: 'fubar',
password: 'pwd',
attributes: {
pisa_id: {
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
value: 'fubar',
type: 'xs:string',
},
},
},
],
});
const port = Number(process.env.PORT || 7000);
app.options.audience = process.env.SAML_AUDIENCE;
app.options.labels.headline = 'SAML Login';
console.log(`Started on port ${port}...`);
app.listen(port);