summaryrefslogtreecommitdiff
path: root/src/Auth.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Auth.js')
-rw-r--r--src/Auth.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Auth.js b/src/Auth.js
index 81ddad9..3c50658 100644
--- a/src/Auth.js
+++ b/src/Auth.js
@@ -44,3 +44,17 @@ export const _getToken = (Just) => (Nothing) => (pair) => () => {
if (token && authnonce) return Just(pair(token)(authnonce));
return Nothing;
};
+
+export const _getSessionCookie = (Just) => (Nothing) => () => {
+ let cookie = null;
+ for (let c of document.cookie.split("; ")) {
+ const [k, v] = c.split("=");
+ if (k === "authelia_session") cookie = v;
+ }
+ if (cookie) return Just(cookie);
+ return Nothing;
+};
+
+export const _clearSessionCookie = () => {
+ document.cookie = "authelia_session=; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=None; Secure";
+};