File tree 5 files changed +23
-18
lines changed
5 files changed +23
-18
lines changed Original file line number Diff line number Diff line change 45
45
; ; Internationalization
46
46
[com.taoensso/tower " 2.0.1" ]]
47
47
48
- :ring {:handler patronage.handler/app-handler
48
+ :ring {:handler patronage.handler/auth- app-handler
49
49
:init patronage.handler/init
50
50
:destroy patronage.handler/destroy}
51
51
Original file line number Diff line number Diff line change 4
4
[compojure.core :refer :all ]
5
5
[compojure.handler :as handler]
6
6
[compojure.route :as route]
7
- [patronage.auth :refer :all ]
7
+ [patronage.auth.github :refer :all ]
8
8
[patronage.models.logging :as logging]
9
9
[patronage.models.migrations :as migrations]
10
- [patronage.routes.api :refer [api-routes]]
10
+ [patronage.routes.api :refer [api-v1- routes]]
11
11
[ragtime.core :refer [migrate-all]]
12
12
[ring.util.response :as response]
13
13
[taoensso.timbre :as timbre]))
40
40
[]
41
41
(timbre/info " patronage is shutting down..." ))
42
42
43
- (def app-handler (-> (routes api-routes
44
- auth-routes
43
+ (def app-handler (-> (routes api-v1-routes
45
44
app-routes)
46
- (friend/requires-scheme-with-proxy :https )
47
- (friend/authenticate {:allow-anon? true
48
- :workflows [github-workflow]})
49
45
handler/site))
46
+
47
+ (def auth-app-handler (-> app-handler
48
+ (friend/requires-scheme-with-proxy :https )
49
+ (friend/authenticate
50
+ {:allow-anon? true
51
+ :workflows [github-workflow]})))
Original file line number Diff line number Diff line change 15
15
; ; server is forced to re-resolve the symbol in the var rather than
16
16
; ; having its own copy. When the root binding changes, the server
17
17
; ; picks it up without having to restart.
18
- (-> #'app-handler
18
+ (-> #'auth- app-handler
19
19
; ; Makes static assets in $PROJECT_DIR/resources/public/ available.
20
20
(wrap-file " resources" )
21
21
; ; Content-Type, Content-Length, and Last Modified headers for files in body
Original file line number Diff line number Diff line change 57
57
58
58
(defroutes api-routes
59
59
(ANY [" /bids/:id" :id #".*" ] [id]
60
- (friend/authenticated ( bid id) ))
60
+ (bid id))
61
61
(ANY " /bids" []
62
- (friend/authenticated bids)))
62
+ bids))
63
+
64
+ (defroutes api-v1-routes
65
+ (context " /api/v1" [] (friend/authorize #{::user } api-routes)))
Original file line number Diff line number Diff line change 1
- (ns patronage.auth-test
2
- (:require [clojure.test :refer [deftest
3
- is
4
- testing]]
5
- [patronage.auth :refer [auth-routes
6
- github-workflow]]
7
- [ring.mock.request :refer [request]]))
1
+ (ns patronage.auth.github -test
2
+ (:require [clojure.test :refer [deftest
3
+ is
4
+ testing]]
5
+ [patronage.auth.github :refer [auth-routes
6
+ github-workflow]]
7
+ [ring.mock.request :refer [request]]))
8
8
9
9
(deftest test-auth-handler
10
10
(let [base-url " https://localhost:3443" ]
You can’t perform that action at this time.
0 commit comments