From 64853b3b14317ff78f8f661200e248584b98e470 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Fri, 19 Jan 2024 08:02:10 +0000 Subject: [PATCH] update config.template.json, update .gitignore, fix required admin membership in openldap init, add set cookie header to delete ticket endpoint --- .gitignore | 1 - config/config.template.json | 3 +++ openldap/init.template.ldif | 2 +- src/main.js | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fef9885..97b35b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ **/package-lock.json **/node_modules -**/*.token **/config.json \ No newline at end of file diff --git a/config/config.template.json b/config/config.template.json index e276693..0b9c115 100644 --- a/config/config.template.json +++ b/config/config.template.json @@ -1,6 +1,9 @@ { + "listenPort": 8082, + "ldapURL": "ldap://localhost", "basedn": "dc=example,dc=com", "sessionSecretKey": "super secret key", + "sessionCookieName": "PAASLDAPAuthTicket", "sessionCookie": { "path": "/", "httpOnly": true, diff --git a/openldap/init.template.ldif b/openldap/init.template.ldif index 28e67b1..886f4e8 100644 --- a/openldap/init.template.ldif +++ b/openldap/init.template.ldif @@ -11,7 +11,7 @@ ou: groups # admin group dn: cn=admins,ou=groups,$BASE_DN objectClass: groupOfNames -member: uid=paas,ou=people,$BASE_DN +member: uid=$ADMIN_ID,ou=people,$BASE_DN cn: admins # paas user diff --git a/src/main.js b/src/main.js index 6302b10..3baf794 100644 --- a/src/main.js +++ b/src/main.js @@ -83,6 +83,8 @@ app.post("/ticket", async (req, res) => { app.delete("/ticket", async (req, res) => { req.session.ldap = null; req.session.destroy(); + const expire = new Date(0); + res.cookie(global.config.sessionCookieName, "", { expires: expire }); res.send({ auth: false }); });