Skip to content

Commit

Permalink
Merge branch 'admin-jwt-renew-reroute-epic' into re-route-impl-reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Jan 14, 2025
2 parents 626f5c4 + 606edee commit eff8d2b
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 291 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ To compile everything for production to `target/bundle`:

## License

Copyright © 2021-2024 Yet Analytics, Inc.
Copyright © 2021-2025 Yet Analytics, Inc.

Distributed under the Apache License version 2.0.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/com/yetanalytics/lrs_admin_ui/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,16 @@

(s/def ::no-val-logout-url string?)

(s/def ::jwt-refresh-interval int?)
(s/def ::jwt-interaction-window int?)
(s/def ::last-interaction-time int?)

(s/def ::db (s/keys :req [::session
::credentials
::login
::browser
::accounts
::new-account
::server-host
::resource-base
::xapi-prefix
Expand All @@ -205,7 +210,10 @@
::status
::update-password
::enable-reactions
::reactions]
::reactions
::jwt-refresh-interval
::jwt-interaction-window
::last-interaction-time]
:opt [::reaction-focus
::editing-reaction
::editing-reaction-template-errors
Expand Down
17 changes: 13 additions & 4 deletions src/com/yetanalytics/lrs_admin_ui/functions/http.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,19 @@


;;JWTs
(defn add-jwt [{:keys [headers] :as request}]
(assoc request :headers
(conj headers {"Authorization"
(format "Bearer %s" @(subscribe [:session/get-token]))})))

(defn add-jwt* [token {:keys [headers] :as request}]
(assoc request
:headers
(conj headers {"Authorization" (format "Bearer %s" token)})))

(defn add-jwt [request]
(let [token @(subscribe [:session/get-token])]
(add-jwt* token request)))

(defn add-jwt-interceptor* [token]
(to-interceptor {:name "JWT Authentication Interceptor"
:request (partial add-jwt* token)}))

(def add-jwt-interceptor
(to-interceptor {:name "JWT Authentication Interceptor"
Expand Down
Loading

0 comments on commit eff8d2b

Please sign in to comment.