Skip to content

Commit

Permalink
Move auth specs
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Dec 18, 2024
1 parent 4204347 commit 8fca27d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/lrsql/util/auth.clj
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@
:secret-key (-> 32 random-bytes bytes->hex)})

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Authorization
;; Specs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Mostly copied from the third LRS:
;; https://github.com/yetanalytics/third/blob/master/src/main/cloud_lrs/impl/auth.cljc
;; These specs are also used in `lrsql.util.oidc`
;; We define them here since they are request-specific and we want to avoid
;; clashes with the `lrsql.spec.auth` namespace.

(s/def ::request-method #{:get :head :put :post :delete})
(s/def ::path-info string?)
Expand All @@ -151,7 +152,12 @@
(s/def ::scope as/keyword-scopes)
(s/def ::scopes (s/coll-of ::scope :kind set?))

(s/def ::result boolean?)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Authorization
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Inspired by the third LRS:
;; https://github.com/yetanalytics/third/blob/master/src/main/cloud_lrs/impl/auth.cljc

(defn- log-scope-error
"Log an error if the scope fail happened due to non-existent scopes (as
Expand Down

0 comments on commit 8fca27d

Please sign in to comment.