Added first mock design and CAS tests

This commit is contained in:
Kevin FEDYNA
2024-12-02 14:21:07 +01:00
parent a5f4a0458f
commit b3fbe6b6c8
8 changed files with 273 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
async function main() {
const initResponse = await fetch("https://ident.univ-amu.fr/cas/login");
const initHTML = await initResponse.text();
const execution = initHTML.match(/(?<=name="execution" value=").*?(?=")/)[0];
const data = new URLSearchParams();
data.append("username", process.env.CAS_USERNAME);
data.append("password", process.env.CAS_PASSWORD);
data.append("_eventId", "submit");
data.append("execution", execution);
const response = await fetch("https://ident.univ-amu.fr/cas/login", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: data.toString()
});
console.log(response.status)
console.log(response.headers);
const content = await response.text();
console.log(content);
}
main()
+15
View File
@@ -0,0 +1,15 @@
const token = process.env.CAS_TOKEN;
async function main() {
const response = await fetch("https://ident.univ-amu.fr/login?service=http://localhost", {
"Cookie": `TGC=${token}`
});
console.log(response.headers);
const responseText = await response.text();
console.log(responseText);
}
main();