Skip to content

Commit 63dc108

Browse files
authored
Merge pull request #169 from modulr-software/deprecate/api-keys
deprecate API keys
2 parents 81d5062 + 2e5c819 commit 63dc108

17 files changed

Lines changed: 1319 additions & 102 deletions

Source.postman_collection.json

Lines changed: 1255 additions & 0 deletions
Large diffs are not rendered by default.

src/source/middleware/auth/core.clj

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,6 @@
6060
(res/response {:message "The bundle you are looking for does not exist."})
6161
(res/status 404))))))
6262

63-
(defn wrap-auth-api-key
64-
"validates the api key from the Authorization header for unauthenticated
65-
users and attaches the bundle-id to the request"
66-
[handler]
67-
(fn [request]
68-
(let [ds (db.util/conn :master)
69-
token (util/auth-token request)
70-
existing-bundle (bundles/bundle ds {:where [:= :hash token]})]
71-
(if (some? existing-bundle)
72-
(-> request
73-
(assoc :bundle-id (:id existing-bundle))
74-
(handler))
75-
(-> (res/response {:message "The bundle you are looking for does not exist."})
76-
(res/status 404))))))
77-
7863
(comment
7964
(let [authed-request {:headers {"Authorization"
8065
(str

src/source/middleware/core.clj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,3 @@
137137
(defn apply-bundle [app]
138138
(-> app
139139
(auth/wrap-bundle-id)))
140-
141-
(defn apply-api-key [app]
142-
(-> app
143-
(auth/wrap-auth-api-key)))

src/source/middleware/interface.clj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@
1212
(defn apply-bundle [app]
1313
(mw/apply-bundle app))
1414

15-
(defn apply-api-key [app]
16-
(mw/apply-api-key app))
17-
1815
(defn apply-validation [app openapi-meta]
1916
(mw/wrap-input-validation app openapi-meta))

src/source/routes/bundle.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[source.db.honey :as hon]))
44

55
(defn get
6-
{:summary "get metadata for the associated uuid-authorized bundle"
7-
:parameters {:query [:map [:uuid :string]]}
6+
{:summary "Get metadata for the associated uuid-authorized bundle."
7+
:parameters {:query [:map [:uuid {:description "Bundle UUID"} :string]]}
88
:responses {200 {:body [:map
99
[:id :int]
1010
[:name :string]

src/source/routes/bundle_categories.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[ring.util.response :as res]))
44

55
(defn get
6-
{:summary "get all categories for content present in the uuid-authorized bundle"
7-
:parameters {:query [:map [:uuid :string]]}
6+
{:summary "Get all categories for which content is present in the uuid-authorized bundle (RSS feeds / posts)."
7+
:parameters {:query [:map [:uuid {:description "Bundle UUID"} :string]]}
88
:responses {200 {:body [:vector
99
[:map
1010
[:id :int]

src/source/routes/bundle_feed.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
[source.services.analytics.interface :as analytics]))
55

66
(defn get
7-
{:summary "get feed associated with the uuid-authorized bundle by id, updates click analytics for the given feed"
8-
:parameters {:query [:map [:uuid :string]]
7+
{:summary "Get a single RSS feed by id from RSS feeds within the uuid-authorized bundle.
8+
This endpoint will update click analytics for the returned RSS feed."
9+
:parameters {:query [:map [:uuid {:description "Bundle UUID"} :string]]
910
:path [:map [:id {:title "id"
10-
:description "feed id"} :int]]}
11+
:description "Feed ID"} :int]]}
1112
:responses {200 {:body [:map
1213
[:id :int]
1314
[:title :string]

src/source/routes/bundle_feed_post.clj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
[source.services.analytics.interface :as analytics]))
55

66
(defn get
7-
{:summary "get post in outgoing feed for the associated uuid-authorized bundle by post id, updates click analytics"
8-
:parameters {:query [:map [:uuid :string]]
9-
:path [:map [:post-id {:title "post-id"
10-
:description "post id"} :int]]}
7+
{:summary "Get a single post by post id belonging to an RSS feed in the associated uuid-authorized bundle.
8+
This endpoint updates click analytics for the returned post."
9+
:parameters {:query [:map [:uuid {:description "Bundle UUID"} :string]]
10+
:path [:map [:post-id {:title "postId"
11+
:description "Post ID"} :int]]}
1112
:responses {200 {:body
1213
[:map
1314
[:id :int]

src/source/routes/bundle_feed_posts.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
[source.services.analytics.interface :as analytics]))
55

66
(defn get
7-
{:summary "get all posts in the outgoing feed for the associated uuid-authorized bundle by feed id"
8-
:parameters {:query [:map [:uuid :string]]
7+
{:summary "Get all posts present within a given RSS feed by feed id, within the uuid-authorized bundle.
8+
This endpoint will update impressions analytics for the returned posts."
9+
:parameters {:query [:map [:uuid {:description "Bundle UUID"} :string]]
910
:path [:map [:id {:title "id"
10-
:description "feed id"} :int]]}
11+
:description "Feed ID"} :int]]}
1112
:responses {200 {:body [:vector
1213
[:map
1314
[:id :int]

src/source/routes/bundle_feeds.clj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
[source.services.analytics.interface :as analytics]))
66

77
(defn post
8-
{:summary "get all feeds present in the bundle authorised by uuid, updating impression analytics."
8+
{:summary "Get all RSS feeds present in the bundle authorised by uuid.
9+
This endpoint will update impressions analytics for the returned RSS feeds."
910
:parameters {:query [:map
10-
[:uuid :string]
11-
[:type {:optional true} :int]
12-
[:latest {:optional true} :boolean]
13-
[:nonfiltered {:optional true} :boolean]]
11+
[:uuid {:description "Bundle UUID"} :string]
12+
[:type {:optional true
13+
:description "Filters by content type ID"} :int]
14+
[:latest {:optional true
15+
:description "Filters by most recently uploaded feeds"} :boolean]
16+
[:nonfiltered {:optional true
17+
:description "Marking this field as true will disable all filters"} :boolean]]
1418
:body [:map [:category-ids [:vector :int]]]}
1519
:responses {200 {:body [:vector
1620
[:map

0 commit comments

Comments
 (0)