From 77594fd2b62e4ea3e6a55fed2dabcce50e618bd3 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 10 May 2025 10:59:30 +0200 Subject: Add oauth for admin interface --- src/chef/pages/home.clj | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/chef/pages/home.clj') diff --git a/src/chef/pages/home.clj b/src/chef/pages/home.clj index 725ba2b..84f643f 100644 --- a/src/chef/pages/home.clj +++ b/src/chef/pages/home.clj @@ -1,10 +1,15 @@ (ns chef.pages.home (:require [hiccup2.core :as html] [ring.util.response :as ruresp] - [chef.pages.utils :as cputils])) + [chef.utils :as cutils] + [ring.middleware.session :as rmsession])) (defn handler [req] - (-> (cputils/gen-page "chef" [:i "Coming soon..."]) - html/html - str - ruresp/response)) + (let [access-token (get-in req [:oauth2/access-tokens :auth]) + resp (-> (cutils/gen-page "chef" [:i "Coming soon..."]) + html/html + str + ruresp/response)] + (if (some? access-token) + (assoc resp :session (assoc (:session req) :oauth-token access-token)) + resp))) -- cgit v1.2.3