Skip to content

Commit

Permalink
Added scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
l4e21 committed Sep 1, 2023
1 parent d535ed6 commit 77e4cc9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions demo/petstore/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,8 @@
"implicit": {
"authorizationUrl": "https://auth.example.org/oauth/authorize",
"scopes": {
"write:pets": "modify pets in your account",
"read:pets": "read your pets"
"https://auth.example.org/scopes/petstore/write": "modify pets in your account",
"https://auth.example.org/scopes/petstore/read": "read your pets"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions installers/auth.example.org/operations/petstore/add-pet.edn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
(for [doc (:docs *prepare*)]
[:xtdb.api/put doc])}

:juxt.site/scope
#{"https://auth.example.org/scopes/petstore/write"}
:juxt.site/rules
[
[(allowed? subject operation resource permission)
Expand Down
9 changes: 9 additions & 0 deletions installers/auth.example.org/scopes/petstore/read.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{:deps
["https://auth.example.org/operations/oauth/register-scope"
"https://auth.example.org/permissions/system/oauth/register-scope"]
:install
{:juxt.site/subject-uri "https://auth.example.org/_site/subjects/system"
:juxt.site/operation-uri "https://auth.example.org/operations/oauth/register-scope"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/description "Read stuff"}}}
9 changes: 9 additions & 0 deletions installers/auth.example.org/scopes/petstore/write.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{:deps
["https://auth.example.org/operations/oauth/register-scope"
"https://auth.example.org/permissions/system/oauth/register-scope"]
:install
{:juxt.site/subject-uri "https://auth.example.org/_site/subjects/system"
:juxt.site/operation-uri "https://auth.example.org/operations/oauth/register-scope"
:juxt.site/input
{:xt/id "{{$id}}"
:juxt.site/description "Write stuff"}}}
6 changes: 5 additions & 1 deletion installers/bundles.edn
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@
{:juxt.site/base-uri "https://auth.example.org"
:juxt.site/installer-path "/permissions/by-role/{{role}}/{{operation}}"
:juxt.site/parameters {"role" "PetstoreOwner"
"operation" "petstore/update-pet-by-id"}}]}
"operation" "petstore/update-pet-by-id"}}
{:juxt.site/base-uri "https://auth.example.org"
:juxt.site/installer-path "/scopes/petstore/read"}
{:juxt.site/base-uri "https://auth.example.org"
:juxt.site/installer-path "/scopes/petstore/write"}]}

"juxt/site/sessions"
{:juxt.site/title "Sessions"
Expand Down

0 comments on commit 77e4cc9

Please sign in to comment.