Skip to content

Commit

Permalink
Cleanup log messages, dangling parameters, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmcorvidae committed Dec 13, 2024
1 parent fc543be commit 79fa556
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/terrain/clients/keycloak/admin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
:headers {:authorization (str "Bearer " token)}
:as :json})]
; the 'exact' query parameter doesn't seem to work on all keycloak versions, so we filter it
(log/error "Got user data" user-data)
(->> user-data
:body
(filter (fn [user] (= (:username user) username)))
Expand All @@ -55,7 +54,6 @@
([user-id]
(get-user-session user-id (:access_token (get-token))))
([user-id token]
(log/error "Getting user sessions for ID" user-id)
(:body (http/get (keycloak-admin-url "users" user-id "sessions")
{:insecure? true
:headers {:authorization (str "Bearer " token)}
Expand All @@ -66,7 +64,5 @@
([username]
(get-user-session-by-username username (:access_token (get-token))))
([username token]
(log/error "Getting user sessions for username" (string/replace username #"@.*$" ""))
(let [user (get-user (string/replace username #"@.*$" "") token)]
(log/error "Got single-user data:" user)
(get-user-session (:id user) token))))
8 changes: 2 additions & 6 deletions src/terrain/routes/bootstrap.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
[terrain.util :refer [optional-routes]]
[terrain.util.config :as config]))

;; Declarations to eliminate lint warnings for path and query parameter bindings.
(declare user-agent ip-address params)

(defn secured-bootstrap-routes
[]
(optional-routes
Expand All @@ -19,10 +16,9 @@
(context "/bootstrap" []
:tags ["bootstrap"]

(GET "/" [:as {{user-agent "user-agent"} :headers}]
:query [{:keys [ip-address]} sessions-schema/IPAddrParam]
(GET "/" []
:return schema/TerrainBootstrapResponse
:summary "Bootstrap Service"
:description "This service obtains information about and initializes the workspace for the authenticated user.
It also records the fact that the user logged in."
(ok (bootstrap user-agent))))))
(ok (bootstrap))))))
3 changes: 1 addition & 2 deletions src/terrain/services/bootstrap.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
(defn bootstrap
"This service obtains information about and initializes the workspace for the authenticated user.
It also records the fact that the user logged in."
[user-agent]
(assertions/assert-valid user-agent "Missing or empty request parameter: user-agent")
[]
(let [{user :shortUsername :keys [email firstName lastName username]} current-user
login-session (future (get-login-session username))
apps-info (future (get-apps-info))
Expand Down

0 comments on commit 79fa556

Please sign in to comment.