Skip to content

Commit 8914f9a

Browse files
Allow encoding scope claims of oauth access token JWT (#4149)
* Refactor token decoding * Add scope decoder to pds * tidy * tidy * tidy * tidy * review changes * Add scope normzlization utility * wording in lexicon * Add specific error * style * tidy * Update `AccessTokenMode` enum values to be more meaningful * tidy * Update .changeset/brown-boxes-bow.md Co-authored-by: devin ivy <[email protected]> * Add retry strategy * lint * lint --------- Co-authored-by: devin ivy <[email protected]>
1 parent d570db4 commit 8914f9a

File tree

40 files changed

+1061
-282
lines changed

40 files changed

+1061
-282
lines changed

.changeset/brown-boxes-bow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@atproto/oauth-scopes": patch
3+
---
4+
5+
Add scope normalization utility

.changeset/dry-crabs-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@atproto/oauth-provider": minor
3+
---
4+
5+
Update `AccessTokenMode` enum values to be more meaningful

.changeset/fast-glasses-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@atproto/oauth-provider": minor
3+
---
4+
5+
Rename `SignedTokenPayload` to `AccessTokenPayload`

.changeset/four-kiwis-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@atproto/oauth-scopes": minor
3+
---
4+
5+
Method `authenticateRequest` now returns `SignedTokenPayload`

.changeset/nasty-needles-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@atproto-labs/simple-store-redis": patch
3+
---
4+
5+
Initial implementation of redis based `SimpleStore` implementation

.changeset/soft-countries-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@atproto/oauth-provider": patch
3+
---
4+
5+
Add `onCreateToken` and `onDecodeToken` hooks to intercept access token JWT claims encoding/decoding
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"lexicon": 1,
3+
"id": "com.atproto.temp.dereferenceScope",
4+
"defs": {
5+
"main": {
6+
"type": "query",
7+
"description": "Allows finding the oauth permission scope from a reference",
8+
"parameters": {
9+
"type": "params",
10+
"required": ["scope"],
11+
"properties": {
12+
"scope": {
13+
"type": "string",
14+
"description": "The scope reference (starts with 'ref:')"
15+
}
16+
}
17+
},
18+
"output": {
19+
"encoding": "application/json",
20+
"schema": {
21+
"type": "object",
22+
"required": ["scope"],
23+
"properties": {
24+
"scope": {
25+
"type": "string",
26+
"description": "The full oauth permission scope"
27+
}
28+
}
29+
}
30+
},
31+
"errors": [
32+
{
33+
"name": "InvalidScopeReference",
34+
"description": "An invalid scope reference was provided."
35+
}
36+
]
37+
}
38+
}
39+
}

packages/api/src/client/index.ts

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api/src/client/lexicons.ts

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api/src/client/types/com/atproto/temp/dereferenceScope.ts

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)