Skip to content

Commit

Permalink
Merge pull request #987 from CSCfi/improved-fake-login
Browse files Browse the repository at this point in the history
feat: support db users in fake login
  • Loading branch information
Macroz committed Mar 6, 2019
2 parents 41c9e43 + 5ff1c16 commit 993c533
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 993c533

Please sign in to comment.