Skip to content

Commit

Permalink
Operation -> Operation URI
Browse files Browse the repository at this point in the history
  • Loading branch information
l4e21 committed Oct 17, 2023
1 parent 1cdd65b commit b5b846c
Show file tree
Hide file tree
Showing 135 changed files with 182 additions and 182 deletions.
4 changes: 2 additions & 2 deletions installer-graph/src/juxt/site/install/common_install_util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@
:juxt.site/events-base-uri (str (get uri-map "https://auth.example.org") "/_site/events/")
:juxt.site/methods
{:get
{:juxt.site/operation (str (get-in uri-map ["https://auth.example.org"]) "/_site/operations/get-bundle-by-id")}
{:juxt.site/operation-uri (str (get-in uri-map ["https://auth.example.org"]) "/_site/operations/get-bundle-by-id")}
:delete
{:juxt.site/operation (str (get-in uri-map ["https://auth.example.org"]) "/_site/operations/delete-bundle-by-id")}}})
{:juxt.site/operation-uri (str (get-in uri-map ["https://auth.example.org"]) "/_site/operations/delete-bundle-by-id")}}})

(def ^:dynamic *working-dir* nil)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
:juxt.site/type "https://meta.juxt.site/types/not-found"

:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/_site/operations/get-not-found"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/_site/operations/get-not-found"}}

:juxt.site/access-control-allow-origins
[[".*" {:juxt.site/access-control-allow-origin "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/_site/operations/all-bundles"
:juxt.site/operation-uri "https://auth.example.org/_site/operations/all-bundles"
:juxt.site/role "https://data.example.org/_site/roles/SiteAdmin"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/_site/operations/create-operation"
:juxt.site/operation-uri "https://auth.example.org/_site/operations/create-operation"
:juxt.site/role "https://data.example.org/_site/roles/SiteAdmin"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/_site/operations/delete-bundle-by-id"
:juxt.site/operation-uri "https://auth.example.org/_site/operations/delete-bundle-by-id"
:juxt.site/role "https://data.example.org/_site/roles/SiteAdmin"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/_site/operations/get-bundle-by-id"
:juxt.site/operation-uri "https://auth.example.org/_site/operations/get-bundle-by-id"
:juxt.site/role "https://data.example.org/_site/roles/SiteAdmin"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/role "https://data.example.org/_site/roles/SiteAdmin"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/_site/operations/get-not-found"}}}
:juxt.site/operation-uri "https://auth.example.org/_site/operations/get-not-found"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; tag::install-system-permissions![]
{:xt/id "{{$id}}"
:juxt.site/type "https://meta.juxt.site/types/permission"
:juxt.site/operation #{"https://auth.example.org/_site/operations/create-operation"
:juxt.site/operation-uri #{"https://auth.example.org/_site/operations/create-operation"
"https://auth.example.org/_site/operations/grant-permission"}
:juxt.site/subject "https://auth.example.org/_site/subjects/system"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/subject "https://auth.example.org/_site/subjects/system"
:juxt.site/operation "https://auth.example.org/_site/operations/install-not-found"}}}
:juxt.site/operation-uri "https://auth.example.org/_site/operations/install-not-found"}}}
4 changes: 2 additions & 2 deletions installers/auth.example.org/operations/assign-role.edn
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
:xt/id (format "https://data.example.org/_site/role-assignments/%s-%s" (or username client-id) rolename)
:juxt.site/type "https://meta.juxt.site/types/role-assignment"
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-role-assignment"}})))}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-role-assignment"}})))}

:juxt.site/transact
{:juxt.site.sci/program
Expand All @@ -61,7 +61,7 @@

;; This operation can be performed via its URI
:juxt.site/methods
{:post {:juxt.site/operation "{{$id}}"
{:post {:juxt.site/operation-uri "{{$id}}"
:juxt.site/acceptable {"accept" "application/json,application/edn"}}}

:juxt.site/protection-spaces #{"https://auth.example.org/protection-spaces/bearer"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
juxt.site.malli/validate-input
(assoc
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-unprotected-resource"}
:post {:juxt.site/operation "https://auth.example.org/operations/login"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-unprotected-resource"}
:post {:juxt.site/operation-uri "https://auth.example.org/operations/login"}}

:juxt.http/content-type "text/html;charset=utf-8"
;; TODO: We could make the HTML content a parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
juxt.site.malli/validate-input
(assoc
:juxt.site/methods
{:post {:juxt.site/operation "https://auth.example.org/operations/logout"}}))))}
{:post {:juxt.site/operation-uri "https://auth.example.org/operations/logout"}}))))}

:juxt.site/transact
{:juxt.site.sci/program
Expand Down
4 changes: 2 additions & 2 deletions installers/auth.example.org/operations/get-api-endpoints.edn
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
'{:find [(pull e [*])]
:where [[e :juxt.site/type "https://meta.juxt.site/types/api-endpoint"]]})
(map first))
[method {operation :juxt.site/operation}] (:juxt.site/methods endpoint)]
[method {operation-uri :juxt.site/operation-uri}] (:juxt.site/methods endpoint)]
{:uri (:xt/id endpoint)
:method (clojure.string/upper-case (name method))
:operation-uri operation})}
:operation-uri operation-uri})}

:juxt.site/scope
#{"https://auth.example.org/scopes/system/read"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
allowed-operations))
(assoc
(name method)
(let [operation (xt/entity (:juxt.site/operation method-details))
(let [operation (xt/entity (:juxt.site/operation-uri method-details))
scope (:juxt.site/scope operation)]
(merge
{"operationId" (:xt/id operation)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
(assoc
:juxt.site/methods
{:get
{:juxt.site/operation "https://auth.example.org/operations/openid/exchange-code-for-id-token"}}
{:juxt.site/operation-uri "https://auth.example.org/operations/openid/exchange-code-for-id-token"}}
:juxt.http/content-type "text/html;charset=utf-8"
:juxt.http/content "<p>This should redirect</p>"))))}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
(assoc
:juxt.site/methods
{:get
{:juxt.site/operation "https://auth.example.org/operations/login-with-openid"}}
{:juxt.site/operation-uri "https://auth.example.org/operations/login-with-openid"}}
:juxt.http/content-type "text/html;charset=utf-8"
:juxt.http/content "<p>This should redirect</p>"))))}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
juxt.site.malli/validate-input
(assoc
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/oauth/view-owned-authorizations"}
:post {:juxt.site/operation "https://auth.example.org/operations/oauth/authorize"}}))))}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/oauth/view-owned-authorizations"}
:post {:juxt.site/operation-uri "https://auth.example.org/operations/oauth/authorize"}}))))}

:juxt.site/transact
{:juxt.site.sci/program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
juxt.site.malli/validate-input
(assoc
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/oauth/get-jwks-document"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/oauth/get-jwks-document"}}
:juxt.http/content-type "application/json"
:juxt.site/respond
{:juxt.site.sci/program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
juxt.site.malli/validate-input
(assoc
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/oauth/get-authorization-server-metadata"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/oauth/get-authorization-server-metadata"}}
:juxt.http/content-type "application/json"
:juxt.site/respond
{:juxt.site.sci/program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
(assoc
:juxt.site/methods
{:post
{:juxt.site/operation "https://auth.example.org/operations/oauth/create-access-token"
{:juxt.site/operation-uri "https://auth.example.org/operations/oauth/create-access-token"
:juxt.site/acceptable {"accept" "application/x-www-form-urlencoded"}}}))))}

:juxt.site/transact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#_:get
#_{:juxt.site/operation "https://auth.example.org/operations/oauth/get-introspect-token-form"}
:post
{:juxt.site/operation "https://auth.example.org/operations/oauth/introspect-token"
{:juxt.site/operation-uri "https://auth.example.org/operations/oauth/introspect-token"
:juxt.site/acceptable {"accept" "application/x-www-form-urlencoded"}}}))))}

:juxt.site/transact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
:juxt.site/type "https://data.example.org/types/pet"
:juxt.site/methods
{:get
{:juxt.site/operation
{:juxt.site/operation-uri
"https://auth.example.org/operations/petstore/get-pet-by-id"}
:delete
{:juxt.site/operation
{:juxt.site/operation-uri
"https://auth.example.org/operations/petstore/delete-pet-by-id"}
:post
{:juxt.site/operation
{:juxt.site/operation-uri
"https://auth.example.org/operations/petstore/update-pet-by-id"}}
:juxt.site/protection-spaces
#{"https://auth.example.org/protection-spaces/bearer"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
:juxt.site/type "https://data.example.org/types/order"
:juxt.site/methods
{:get
{:juxt.site/operation
{:juxt.site/operation-uri
"https://auth.example.org/operations/petstore/order/get-by-id"}
:delete
{:juxt.site/operation
{:juxt.site/operation-uri
"https://auth.example.org/operations/petstore/order/delete-by-id"}}
:juxt.site/protection-spaces
#{"https://auth.example.org/protection-spaces/bearer"}
Expand Down
6 changes: 3 additions & 3 deletions installers/auth.example.org/operations/post-openapi.edn
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{:xt/id (str base-uri "/openapi.json")
:juxt.site/type "https://meta.juxt.site/types/openapi-document"
:juxt.http/content-type "application/json"
:juxt.site/methods {:get {:juxt.site/operation "https://auth.example.org/operations/get-openapi-document"}}
:juxt.site/methods {:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-openapi-document"}}
:openapi.v3/definition openapi

:juxt.site/access-control-allow-origins
Expand All @@ -69,7 +69,7 @@
(for [[method operation] path-obj
:let [request-body (get operation "requestBody")]]
[(keyword method)
(cond-> {:juxt.site/operation (get operation "operationId")
(cond-> {:juxt.site/operation-uri (get operation "operationId")
:openapi.v3/metadata operation}
request-body
(assoc :juxt.site/acceptable
Expand All @@ -96,7 +96,7 @@
(for [[method operation] path-obj
:let [request-body (get operation "requestBody")]]
[(keyword method)
(cond-> {:juxt.site/operation (get operation "operationId")}
(cond-> {:juxt.site/operation-uri (get operation "operationId")}
request-body
(assoc :juxt.site/acceptable
(clojure.string/join "," (keys (get request-body "content")))))]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{:juxt.site/type "https://meta.juxt.site/types/openapi-document"

:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-openapi-document"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-openapi-document"}}

:juxt.site/access-control-allow-origins
[[".*" {:juxt.site/access-control-allow-origin "*"
Expand Down
2 changes: 1 addition & 1 deletion installers/auth.example.org/operations/put-role.edn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(assoc
:juxt.site/type "https://meta.juxt.site/types/role"
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-role"}}))))}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-role"}}))))}

:juxt.site/transact
{:juxt.site.sci/program
Expand Down
4 changes: 2 additions & 2 deletions installers/auth.example.org/operations/put-user.edn
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
:juxt.site/username username
:juxt.site/type "https://meta.juxt.site/types/user"
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-user"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-user"}}
:juxt.site/protection-spaces #{"https://auth.example.org/protection-spaces/bearer"}

:juxt.site/access-control-allow-origins
Expand All @@ -67,7 +67,7 @@
base
{:juxt.site/variant-of user-uri
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-user"}}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-user"}}
:juxt.site/protection-spaces #{"https://auth.example.org/protection-spaces/bearer"}
:juxt.site/access-control-allow-origins
[[".*" {:juxt.site/access-control-allow-origin "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(assoc :juxt.site/type #{"https://meta.juxt.site/types/user-identity"
"https://meta.juxt.site/types/openid-user-identity"}
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-user-identity"}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-user-identity"}
:options {}}))))}

:juxt.site/transact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:juxt.site/type #{"https://meta.juxt.site/types/user-identity"
"https://meta.juxt.site/types/basic-user-identity"}
:juxt.site/methods
{:get {:juxt.site/operation "https://auth.example.org/operations/get-user-identity"}
{:get {:juxt.site/operation-uri "https://auth.example.org/operations/get-user-identity"}
:options {}}))]
(-> input
;; We want usernames to be case-insensitive, as per OWASP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/{{operation}}"
:juxt.site/operation-uri "https://auth.example.org/operations/{{operation}}"
:juxt.site/role "https://data.example.org/_site/roles/{{role}}"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/get-access-token"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/get-access-token"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/get-openapi-document"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/get-openapi-document"}}}
2 changes: 1 addition & 1 deletion installers/auth.example.org/permissions/get-operations.edn
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/get-operations"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/get-operations"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/get-unprotected-resource"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/get-unprotected-resource"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/login-with-openid"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/login-with-openid"}}}
2 changes: 1 addition & 1 deletion installers/auth.example.org/permissions/login.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/login"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/login"}}}
2 changes: 1 addition & 1 deletion installers/auth.example.org/permissions/logout.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/logout"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/logout"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation #{"https://auth.example.org/operations/oauth/authorize"}}}}
:juxt.site/operation-uri #{"https://auth.example.org/operations/oauth/authorize"}}}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation #{"https://auth.example.org/operations/oauth/create-access-token"}}}}
:juxt.site/operation-uri #{"https://auth.example.org/operations/oauth/create-access-token"}}}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/oauth/get-authorization-server-metadata"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/oauth/get-authorization-server-metadata"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:juxt.site/operation-uri "https://auth.example.org/_site/operations/grant-permission"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/operation "https://auth.example.org/operations/oauth/get-introspect-token-form"}}}
:juxt.site/operation-uri "https://auth.example.org/operations/oauth/get-introspect-token-form"}}}
Loading

0 comments on commit b5b846c

Please sign in to comment.