Skip to content

Commit

Permalink
feat: support db users in fake login
Browse files Browse the repository at this point in the history
Previously we matched user against fake user data but since we read
the users from the database we can match against them in the fake
login and allow logging in with any of them.
  • Loading branch information
Macroz committed Mar 6, 2019
1 parent 41c9e43 commit 5ff1c16
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/clj/rems/auth/fake_shibboleth.clj
Expand Up @@ -4,6 +4,7 @@
[hiccup.util :refer [url]]
[rems.db.core :as db]
[rems.db.test-data :refer [+fake-user-data+]]
[rems.json :as json]
[ring.util.response :refer [content-type redirect
response]]))

Expand Down Expand Up @@ -45,7 +46,9 @@ a:visited { color: #fff; }

(defn- fake-login [session username]
(assoc (redirect "/#/redirect")
:session (assoc session :identity (get +fake-user-data+ username))))
:session (assoc session :identity (-> (db/get-user-attributes {:user username})
:userattrs
json/parse-string))))

(defn- user-selection [username]
(let [url (url "/Shibboleth.sso/Login" {:username username})]
Expand Down

0 comments on commit 5ff1c16

Please sign in to comment.