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
|
const jsdom = require('jsdom');
const { getDOM, submitForm, extractStart } = require('../api');
const edu = require('./educonnect');
async function login({ url, account, username, password, casUrl, idp })
{
const jar = new jsdom.CookieJar();
// Select EduConnect
let dom = await getDOM({
url: `https://${casUrl}/login?&selection=${idp}&service=${url}&submit=Valider`,
jar,
followRedirects: true
});
// Send SAML Request to EduConnect
dom = await submitForm({
dom,
jar
});
await edu({ dom, jar, username, password });
return extractStart(await getDOM({ url: url + account.value + '.html', jar, asIs: true }));
}
module.exports = login;
|