@atproto/oauth-client 0.1.2-rc.1 → 0.1.2-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +0 -14
- package/README.md +4 -2
- package/dist/oauth-atp-agent.d.ts +1 -1
- package/dist/oauth-atp-agent.d.ts.map +1 -1
- package/dist/oauth-atp-agent.js +1 -2
- package/dist/oauth-atp-agent.js.map +1 -1
- package/dist/oauth-authorization-server-metadata-resolver.d.ts.map +1 -1
- package/dist/oauth-authorization-server-metadata-resolver.js +5 -0
- package/dist/oauth-authorization-server-metadata-resolver.js.map +1 -1
- package/dist/oauth-client.d.ts +1 -1
- package/dist/oauth-client.d.ts.map +1 -1
- package/dist/oauth-client.js +1 -10
- package/dist/oauth-client.js.map +1 -1
- package/dist/oauth-protected-resource-metadata-resolver.d.ts.map +1 -1
- package/dist/oauth-protected-resource-metadata-resolver.js +5 -4
- package/dist/oauth-protected-resource-metadata-resolver.js.map +1 -1
- package/dist/oauth-resolver.d.ts +21 -7
- package/dist/oauth-resolver.d.ts.map +1 -1
- package/dist/oauth-resolver.js +57 -17
- package/dist/oauth-resolver.js.map +1 -1
- package/dist/oauth-server-agent.d.ts.map +1 -1
- package/dist/oauth-server-agent.js +3 -1
- package/dist/oauth-server-agent.js.map +1 -1
- package/dist/oauth-server-factory.d.ts.map +1 -1
- package/dist/oauth-server-factory.js +1 -1
- package/dist/oauth-server-factory.js.map +1 -1
- package/dist/session-getter.js +1 -1
- package/dist/session-getter.js.map +1 -1
- package/package.json +10 -10
- package/src/oauth-atp-agent.ts +2 -3
- package/src/oauth-authorization-server-metadata-resolver.ts +8 -0
- package/src/oauth-client.ts +4 -10
- package/src/oauth-protected-resource-metadata-resolver.ts +9 -4
- package/src/oauth-resolver.ts +92 -33
- package/src/oauth-server-agent.ts +3 -1
- package/src/oauth-server-factory.ts +4 -1
- package/src/session-getter.ts +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,19 +1,5 @@
|
|
1
1
|
# @atproto/oauth-client
|
2
2
|
|
3
|
-
## 0.1.2-rc.1
|
4
|
-
|
5
|
-
### Patch Changes
|
6
|
-
|
7
|
-
- Misc fixes for confidential client usage
|
8
|
-
|
9
|
-
## 0.1.2-rc.0
|
10
|
-
|
11
|
-
### Patch Changes
|
12
|
-
|
13
|
-
- Updated dependencies [[`2ded0156b`](https://github.com/bluesky-social/atproto/commit/2ded0156b9adf33b9cce66583a375bff922d383b), [`2ded0156b`](https://github.com/bluesky-social/atproto/commit/2ded0156b9adf33b9cce66583a375bff922d383b)]:
|
14
|
-
- @atproto/xrpc@0.6.0-rc.0
|
15
|
-
- @atproto/api@0.13.0-rc.0
|
16
|
-
|
17
3
|
## 0.1.1
|
18
4
|
|
19
5
|
### Patch Changes
|
package/README.md
CHANGED
@@ -155,8 +155,10 @@ await agent.post({
|
|
155
155
|
text: 'Hello, world!',
|
156
156
|
})
|
157
157
|
|
158
|
-
|
159
|
-
|
158
|
+
if (agent instanceof AtpAgent) {
|
159
|
+
// revoke credentials on the server (causing sessionStore.del() to be called)
|
160
|
+
await agent.logout()
|
161
|
+
}
|
160
162
|
```
|
161
163
|
|
162
164
|
## Advances use-cases
|
@@ -3,7 +3,7 @@ import { OAuthAgent } from './oauth-agent.js';
|
|
3
3
|
export declare class OAuthAtpAgent extends Agent {
|
4
4
|
readonly oauthAgent: OAuthAgent;
|
5
5
|
constructor(oauthAgent: OAuthAgent);
|
6
|
-
clone():
|
6
|
+
clone(): OAuthAtpAgent;
|
7
7
|
get did(): string;
|
8
8
|
signOut(): Promise<void>;
|
9
9
|
refreshIfNeeded(): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-atp-agent.d.ts","sourceRoot":"","sources":["../src/oauth-atp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAIpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,qBAAa,aAAc,SAAQ,KAAK;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU;gBAAtB,UAAU,EAAE,UAAU;IAyB3C,KAAK,IAAI,
|
1
|
+
{"version":3,"file":"oauth-atp-agent.d.ts","sourceRoot":"","sources":["../src/oauth-atp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAIpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,qBAAa,aAAc,SAAQ,KAAK;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU;gBAAtB,UAAU,EAAE,UAAU;IAyB3C,KAAK,IAAI,aAAa;IAItB,IAAI,GAAG,IAAI,MAAM,CAEhB;IAEK,OAAO;IAIA,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9C"}
|
package/dist/oauth-atp-agent.js
CHANGED
@@ -35,8 +35,7 @@ class OAuthAtpAgent extends api_1.Agent {
|
|
35
35
|
});
|
36
36
|
}
|
37
37
|
clone() {
|
38
|
-
|
39
|
-
return this.copyInto(agent);
|
38
|
+
return this.copyInto(new OAuthAtpAgent(this.oauthAgent));
|
40
39
|
}
|
41
40
|
get did() {
|
42
41
|
return this.oauthAgent.sub;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-atp-agent.js","sourceRoot":"","sources":["../src/oauth-atp-agent.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AACpC,wCAAyC;AACzC,+CAAoE;AAIpE,MAAa,aAAc,SAAQ,WAAK;IACtC,YAAqB,UAAsB;QACzC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YACxB,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YACjD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,kBAAU,EAAE,CAAC;oBAChC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KA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I,KAAK,YAAY,0BAAkB,EAAE,CAAC;oBACxC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;oBAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;oBAC9D,MAAM,IAAI,gBAAS,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE;wBAC3D,KAAK;qBACN,CAAC,CAAA;gBACJ,CAAC;gBAED,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC,CAAC,CAAA;QAtBQ;;;;mBAAS,UAAU;WAAY;IAuB3C,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;IACjC,CAAC;IAEM,KAAK,CAAC,eAAe;QAC1B,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA;IACzC,CAAC;CACF;AAzCD,sCAyCC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-authorization-server-metadata-resolver.d.ts","sourceRoot":"","sources":["../src/oauth-authorization-server-metadata-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,gCAAgC,EAGjC,MAAM,sBAAsB,CAAA;AAG7B,YAAY,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,CAAA;AAElE,MAAM,MAAM,gCAAgC,GAAG,WAAW,CACxD,MAAM,EACN,gCAAgC,CACjC,CAAA;AAED;;GAEG;AACH,qBAAa,wCAAyC,SAAQ,YAAY,CACxE,MAAM,EACN,gCAAgC,CACjC;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAE1B,KAAK,EAAE,gCAAgC,EAAE,KAAK,CAAC,EAAE,KAAK;IAM5D,GAAG,CACP,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,CAAC;YAI9B,aAAa;
|
1
|
+
{"version":3,"file":"oauth-authorization-server-metadata-resolver.d.ts","sourceRoot":"","sources":["../src/oauth-authorization-server-metadata-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,gCAAgC,EAGjC,MAAM,sBAAsB,CAAA;AAG7B,YAAY,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,CAAA;AAElE,MAAM,MAAM,gCAAgC,GAAG,WAAW,CACxD,MAAM,EACN,gCAAgC,CACjC,CAAA;AAED;;GAEG;AACH,qBAAa,wCAAyC,SAAQ,YAAY,CACxE,MAAM,EACN,gCAAgC,CACjC;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAE1B,KAAK,EAAE,gCAAgC,EAAE,KAAK,CAAC,EAAE,KAAK;IAM5D,GAAG,CACP,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,CAAC;YAI9B,aAAa;CA0D5B"}
|
@@ -49,6 +49,11 @@ class OAuthAuthorizationServerMetadataResolver extends simple_store_1.CachedGett
|
|
49
49
|
if (metadata.issuer !== issuer) {
|
50
50
|
throw new TypeError(`Invalid issuer ${metadata.issuer}`);
|
51
51
|
}
|
52
|
+
// ATPROTO requires client_id_metadata_document
|
53
|
+
// http://drafts.aaronpk.com/draft-parecki-oauth-client-id-metadata-document/draft-parecki-oauth-client-id-metadata-document.html
|
54
|
+
if (metadata.client_id_metadata_document_supported !== true) {
|
55
|
+
throw new TypeError(`Authorization server "${issuer}" does not support client_id_metadata_document`);
|
56
|
+
}
|
52
57
|
return metadata;
|
53
58
|
}
|
54
59
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-authorization-server-metadata-resolver.js","sourceRoot":"","sources":["../src/oauth-authorization-server-metadata-resolver.ts"],"names":[],"mappings":";;;AAAA,+CAK4B;AAC5B,6DAImC;AACnC,sDAI6B;AAC7B,iCAAoC;AASpC;;GAEG;AACH,MAAa,wCAAyC,SAAQ,2BAG7D;IAGC,YAAY,KAAuC,EAAE,KAAa;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,CAAA;QAH7D;;;;;WAAqB;QAKpC,IAAI,CAAC,KAAK,GAAG,IAAA,iBAAS,EAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,GAAG,CACP,MAAc,EACd,OAA0B;QAE1B,OAAO,KAAK,CAAC,GAAG,CAAC,yCAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAEO,KAAK,CAAC,aAAa,CACzB,MAAc,EACd,OAA0B;QAE1B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAA;QAC7D,IAAI,OAAO,EAAE,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;QAE9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,yCAAyC,EAAE,MAAM,CAAC,CAAA;QACtE,MAAM,OAAO,GA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C,CAAA;YACjC,MAAM,MAAM,0BAAkB,CAAC,IAAI,CACjC,QAAQ,EACR,0BAA0B,QAAQ,CAAC,MAAM,SAAS,GAAG,GAAG,EACxD,SAAS,EACT,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAA;QACH,CAAC;QAED,IAAI,IAAA,kBAAW,EAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,kBAAkB,EAAE,CAAC;YACzD,MAAM,IAAA,kBAAU,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;YACjC,MAAM,MAAM,0BAAkB,CAAC,IAAI,CACjC,QAAQ,EACR,gCAAgC,GAAG,GAAG,EACtC,SAAS,EACT,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAA;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,uDAAyC,CAAC,KAAK,CAC9D,MAAM,QAAQ,CAAC,IAAI,EAAE,CACtB,CAAA;QAED,uCAAuC;QACvC,6FAA6F;QAC7F,0DAA0D;QAC1D,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC/B,MAAM,IAAI,SAAS,CAAC,kBAAkB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;QAC1D,CAAC;QAED,+CAA+C;QAC/C,iIAAiI;QACjI,IAAI,QAAQ,CAAC,qCAAqC,KAAK,IAAI,EAAE,CAAC;YAC5D,MAAM,IAAI,SAAS,CACjB,yBAAyB,MAAM,gDAAgD,CAChF,CAAA;QACH,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AA7ED,4FA6EC"}
|
package/dist/oauth-client.d.ts
CHANGED
@@ -185,7 +185,7 @@ export declare class OAuthClient extends CustomEventTarget<OAuthClientEventMap>
|
|
185
185
|
readonly stateStore: StateStore;
|
186
186
|
constructor({ fetch, stateStore, sessionStore, didCache, dpopNonceCache, handleCache, authorizationServerMetadataCache, protectedResourceMetadataCache, responseMode, clientMetadata, handleResolver, plcDirectoryUrl, runtimeImplementation, keyset, }: OAuthClientOptions);
|
187
187
|
get identityResolver(): IdentityResolver;
|
188
|
-
get didResolver(): import("@atproto-labs/did-resolver").DidResolver<"
|
188
|
+
get didResolver(): import("@atproto-labs/did-resolver").DidResolver<import("@atproto-labs/did-resolver").AtprotoIdentityDidMethods>;
|
189
189
|
get handleResolver(): HandleResolver;
|
190
190
|
get jwks(): {
|
191
191
|
readonly keys: readonly ({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-client.d.ts","sourceRoot":"","sources":["../src/oauth-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAGL,WAAW,EACX,cAAc,EACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EAExB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAK7B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EACL,gCAAgC,EAEjC,MAAM,mDAAmD,CAAA;AAE1D,OAAO,EAEL,8BAA8B,EAC/B,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,qBAAqB,CAAA;AAC5B,OA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server will enforce this, but let's catch it early
|
151
151
|
throw new TypeError('Invalid redirect_uri');
|
152
152
|
}
|
153
|
-
const
|
154
|
-
const { identity, metadata } = /^https?:\/\//.test(input)
|
155
|
-
? // Allow using an entryway url directly as login input (e.g. when the
|
156
|
-
// user forgot their handle, or when the handle does not resolve to a
|
157
|
-
// DID)
|
158
|
-
{
|
159
|
-
identity: undefined,
|
160
|
-
metadata: await this.oauthResolver.resolveMetadata(input, { signal }),
|
161
|
-
}
|
162
|
-
: await this.oauthResolver.resolve(input, { signal });
|
153
|
+
const { identity, metadata } = await this.oauthResolver.resolve(input, options);
|
163
154
|
const nonce = await this.runtime.generateNonce();
|
164
155
|
const pkce = await this.runtime.generatePKCE();
|
165
156
|
const dpopKey = await this.runtime.generateKey(metadata.dpop_signing_alg_values_supported || [constants_js_1.FALLBACK_ALG]);
|
package/dist/oauth-client.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-client.js","sourceRoot":"","sources":["../src/oauth-client.ts"],"names":[],"mappings":";;;AAAA,6DAImC;AAEnC,mEAKsC;AACtC,uEAAkE;AAClE,2EAAqE;AACrE,sCAA0C;AAC1C,sDAM6B;AAE7B,iDAA6C;AAC7C,4EAAmE;AACnE,qDAA6C;AAC7C,6DAAoD;AACpD,uHAG0D;AAC1D,uEAA8D;AAC9D,mHAGwD;AACxD,2DAAmD;AAEnD,uEAA8D;AAE9D,6CAAsC;AACtC,2DAI4B;AAG5B,uCAA6C;AAC7C,+EAAsE;AAoDtE,MAAa,WAAY,SAAQ,2BAAsC;IACrE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EACzB,QAAQ,EACR,KAAK,GAAG,UAAU,CAAC,KAAK,EACxB,MAAM,GAC0B;QAChC,MAAM,EAAE,cAAc,EAAE,CAAA;QAExB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpC,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,MAAM;SACf,CAAC,CAA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SAC9B,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAC/D,GAAG,EACH,KAAK,CACN,CAAA;QAED,0EAA0E;QAC1E,2EAA2E;QAC3E,QAAQ;QACR,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;YACzE,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;QAC5C,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,0CAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;IAED,WAAW,CAAC,MAAwB,EAAE,GAAW;QAC/C,MAAM,UAAU,GAAG,IAAI,2BAAU,CAC/B,MAAM,EACN,GAAG,EACH,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,KAAK,CACX,CAAA;QAED,OAAO,IAAI,kCAAa,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC;CACF;AA/ZD,kCA+ZC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-protected-resource-metadata-resolver.d.ts","sourceRoot":"","sources":["../src/oauth-protected-resource-metadata-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAIN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,
|
1
|
+
{"version":3,"file":"oauth-protected-resource-metadata-resolver.d.ts","sourceRoot":"","sources":["../src/oauth-protected-resource-metadata-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAIN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAEL,8BAA8B,EAE/B,MAAM,sBAAsB,CAAA;AAG7B,YAAY,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,CAAA;AAEhE,MAAM,MAAM,8BAA8B,GAAG,WAAW,CACtD,MAAM,EACN,8BAA8B,CAC/B,CAAA;AAED;;GAEG;AACH,qBAAa,sCAAuC,SAAQ,YAAY,CACtE,MAAM,EACN,8BAA8B,CAC/B;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAGpC,KAAK,EAAE,8BAA8B,EACrC,KAAK,GAAE,KAAwB;IAO3B,GAAG,CACP,QAAQ,EAAE,MAAM,GAAG,GAAG,EACtB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,8BAA8B,CAAC;YAY5B,aAAa;CAgD5B"}
|
@@ -21,10 +21,11 @@ class OAuthProtectedResourceMetadataResolver extends simple_store_1.CachedGetter
|
|
21
21
|
}
|
22
22
|
async get(resource, options) {
|
23
23
|
const { protocol, origin } = new URL(resource);
|
24
|
-
if (protocol
|
25
|
-
|
24
|
+
if (protocol === 'https:' ||
|
25
|
+
(protocol === 'http:' && oauth_types_1.ALLOW_UNSECURE_ORIGINS)) {
|
26
|
+
return super.get(origin, options);
|
26
27
|
}
|
27
|
-
|
28
|
+
throw new TypeError(`Forbidden resource sercure protocol "${protocol}"`);
|
28
29
|
}
|
29
30
|
async fetchMetadata(origin, options) {
|
30
31
|
const headers = new Headers([['accept', 'application/json']]);
|
@@ -34,7 +35,7 @@ class OAuthProtectedResourceMetadataResolver extends simple_store_1.CachedGetter
|
|
34
35
|
const request = new Request(url, {
|
35
36
|
signal: options?.signal,
|
36
37
|
headers,
|
37
|
-
redirect: '
|
38
|
+
redirect: 'manual', // response must be 200 OK
|
38
39
|
});
|
39
40
|
const response = await this.fetch(request);
|
40
41
|
// https://datatracker.ietf.org/doc/html/draft-ietf-oauth-resource-metadata-05#section-3.2
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-protected-resource-metadata-resolver.js","sourceRoot":"","sources":["../src/oauth-protected-resource-metadata-resolver.ts"],"names":[],"mappings":";;;AAAA,+CAK4B;AAC5B,6DAImC;AACnC,
|
1
|
+
{"version":3,"file":"oauth-protected-resource-metadata-resolver.js","sourceRoot":"","sources":["../src/oauth-protected-resource-metadata-resolver.ts"],"names":[],"mappings":";;;AAAA,+CAK4B;AAC5B,6DAImC;AACnC,sDAI6B;AAC7B,iCAAoC;AASpC;;GAEG;AACH,MAAa,sCAAuC,SAAQ,2BAG3D;IAGC,YACE,KAAqC,EACrC,QAAe,UAAU,CAAC,KAAK;QAE/B,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,CAAA;QAN7D;;;;;WAAqB;QAQpC,IAAI,CAAC,KAAK,GAAG,IAAA,iBAAS,EAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,GAAG,CACP,QAAsB,EACtB,OAA0B;QAE1B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;QAC9C,IACE,QAAQ,KAAK,QAAQ;YACrB,CAAC,QAAQ,KAAK,OAAO,IAAI,oCAAsB,CAAC,EAChD,CAAC;YACD,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACnC,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,wCAAwC,QAAQ,GAAG,CAAC,CAAA;IAC1E,CAAC;IAEO,KAAK,CAAC,aAAa,CACzB,MAAc,EACd,OAA0B;QAE1B,MAAM,OAAO,GAA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,EAAE,CAAC;YACjC,MAAM,IAAI,SAAS,CAAC,kBAAkB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC5D,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AA9ED,wFA8EC"}
|
package/dist/oauth-resolver.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { IdentityResolver, ResolvedIdentity, ResolveIdentityOptions } from '@atproto-labs/identity-resolver';
|
2
2
|
import { OAuthAuthorizationServerMetadata } from '@atproto/oauth-types';
|
3
3
|
import { GetCachedOptions, OAuthAuthorizationServerMetadataResolver } from './oauth-authorization-server-metadata-resolver.js';
|
4
4
|
import { OAuthProtectedResourceMetadataResolver } from './oauth-protected-resource-metadata-resolver.js';
|
@@ -9,9 +9,27 @@ export declare class OAuthResolver {
|
|
9
9
|
readonly protectedResourceMetadataResolver: OAuthProtectedResourceMetadataResolver;
|
10
10
|
readonly authorizationServerMetadataResolver: OAuthAuthorizationServerMetadataResolver;
|
11
11
|
constructor(identityResolver: IdentityResolver, protectedResourceMetadataResolver: OAuthProtectedResourceMetadataResolver, authorizationServerMetadataResolver: OAuthAuthorizationServerMetadataResolver);
|
12
|
+
/**
|
13
|
+
* @param input - A handle, DID, PDS URL or Entryway URL
|
14
|
+
*/
|
15
|
+
resolve(input: string, options?: ResolveOAuthOptions): Promise<{
|
16
|
+
identity?: ResolvedIdentity;
|
17
|
+
metadata: OAuthAuthorizationServerMetadata;
|
18
|
+
}>;
|
19
|
+
/**
|
20
|
+
* @note this method can be used to verify if a particular uri supports OAuth
|
21
|
+
* based sign-in (for compatibility with legacy implementation).
|
22
|
+
*/
|
23
|
+
resolveFromService(input: string, options?: ResolveOAuthOptions): Promise<{
|
24
|
+
metadata: OAuthAuthorizationServerMetadata;
|
25
|
+
}>;
|
26
|
+
resolveFromIdentity(input: string, options?: ResolveOAuthOptions): Promise<{
|
27
|
+
identity: ResolvedIdentity;
|
28
|
+
metadata: OAuthAuthorizationServerMetadata;
|
29
|
+
}>;
|
12
30
|
resolveIdentity(input: string, options?: ResolveIdentityOptions): Promise<ResolvedIdentity>;
|
13
|
-
|
14
|
-
|
31
|
+
getAuthorizationServerMetadata(issuer: string, options?: GetCachedOptions): Promise<OAuthAuthorizationServerMetadata>;
|
32
|
+
getResourceServerMetadata(pdsUrl: string | URL, options?: GetCachedOptions): Promise<{
|
15
33
|
issuer: string;
|
16
34
|
authorization_endpoint: string;
|
17
35
|
token_endpoint: string;
|
@@ -55,9 +73,5 @@ export declare class OAuthResolver {
|
|
55
73
|
protected_resources?: string[] | undefined;
|
56
74
|
client_id_metadata_document_supported?: boolean | undefined;
|
57
75
|
}>;
|
58
|
-
resolve(input: string, options?: ResolveOAuthOptions): Promise<{
|
59
|
-
identity: ResolvedIdentity;
|
60
|
-
metadata: OAuthAuthorizationServerMetadata;
|
61
|
-
}>;
|
62
76
|
}
|
63
77
|
//# sourceMappingURL=oauth-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-resolver.d.ts","sourceRoot":"","sources":["../src/oauth-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
1
|
+
{"version":3,"file":"oauth-resolver.d.ts","sourceRoot":"","sources":["../src/oauth-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,gCAAgC,EAEjC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,gBAAgB,EAChB,wCAAwC,EACzC,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAA;AAGxG,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAChC,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,sBAAsB,CAAA;AAE3E,qBAAa,aAAa;IAEtB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IAC3C,QAAQ,CAAC,iCAAiC,EAAE,sCAAsC;IAClF,QAAQ,CAAC,mCAAmC,EAAE,wCAAwC;gBAF7E,gBAAgB,EAAE,gBAAgB,EAClC,iCAAiC,EAAE,sCAAsC,EACzE,mCAAmC,EAAE,wCAAwC;IAGxF;;OAEG;IACU,OAAO,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;QACT,QAAQ,CAAC,EAAE,gBAAgB,CAAA;QAC3B,QAAQ,EAAE,gCAAgC,CAAA;KAC3C,CAAC;IASF;;;OAGG;IACU,kBAAkB,CAC7B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;QACT,QAAQ,EAAE,gCAAgC,CAAA;KAC3C,CAAC;IA0BW,mBAAmB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;QACT,QAAQ,EAAE,gBAAgB,CAAA;QAC1B,QAAQ,EAAE,gCAAgC,CAAA;KAC3C,CAAC;IAUW,eAAe,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAWf,8BAA8B,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,CAAC;IAW/B,yBAAyB,CACpC,MAAM,EAAE,MAAM,GAAG,GAAG,EACpB,OAAO,CAAC,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C7B"}
|
package/dist/oauth-resolver.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.OAuthResolver = void 0;
|
4
|
+
const oauth_types_1 = require("@atproto/oauth-types");
|
4
5
|
const oauth_resolver_error_js_1 = require("./oauth-resolver-error.js");
|
5
6
|
class OAuthResolver {
|
6
7
|
constructor(identityResolver, protectedResourceMetadataResolver, authorizationServerMetadataResolver) {
|
@@ -23,6 +24,50 @@ class OAuthResolver {
|
|
23
24
|
value: authorizationServerMetadataResolver
|
24
25
|
});
|
25
26
|
}
|
27
|
+
/**
|
28
|
+
* @param input - A handle, DID, PDS URL or Entryway URL
|
29
|
+
*/
|
30
|
+
async resolve(input, options) {
|
31
|
+
// Allow using an entryway, or PDS url, directly as login input (e.g.
|
32
|
+
// when the user forgot their handle, or when the handle does not
|
33
|
+
// resolve to a DID)
|
34
|
+
return /^https?:\/\//.test(input)
|
35
|
+
? this.resolveFromService(input, options)
|
36
|
+
: this.resolveFromIdentity(input, options);
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* @note this method can be used to verify if a particular uri supports OAuth
|
40
|
+
* based sign-in (for compatibility with legacy implementation).
|
41
|
+
*/
|
42
|
+
async resolveFromService(input, options) {
|
43
|
+
try {
|
44
|
+
// Assume first that input is a PDS URL (as required by ATPROTO)
|
45
|
+
const metadata = await this.getResourceServerMetadata(input, options);
|
46
|
+
return { metadata };
|
47
|
+
}
|
48
|
+
catch (err) {
|
49
|
+
if (!options?.signal?.aborted && err instanceof oauth_resolver_error_js_1.OAuthResolverError) {
|
50
|
+
try {
|
51
|
+
// Fallback to trying to fetch as an issuer (Entryway)
|
52
|
+
const result = oauth_types_1.oauthIssuerIdentifierSchema.safeParse(input);
|
53
|
+
if (result.success) {
|
54
|
+
const metadata = await this.getAuthorizationServerMetadata(result.data, options);
|
55
|
+
return { metadata };
|
56
|
+
}
|
57
|
+
}
|
58
|
+
catch {
|
59
|
+
// Fallback failed, throw original error
|
60
|
+
}
|
61
|
+
}
|
62
|
+
throw err;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
async resolveFromIdentity(input, options) {
|
66
|
+
const identity = await this.resolveIdentity(input, options);
|
67
|
+
options?.signal?.throwIfAborted();
|
68
|
+
const metadata = await this.getResourceServerMetadata(identity.pds, options);
|
69
|
+
return { identity, metadata };
|
70
|
+
}
|
26
71
|
async resolveIdentity(input, options) {
|
27
72
|
try {
|
28
73
|
return await this.identityResolver.resolve(input, options);
|
@@ -31,7 +76,7 @@ class OAuthResolver {
|
|
31
76
|
throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve identity: ${input}`);
|
32
77
|
}
|
33
78
|
}
|
34
|
-
async
|
79
|
+
async getAuthorizationServerMetadata(issuer, options) {
|
35
80
|
try {
|
36
81
|
return await this.authorizationServerMetadataResolver.get(issuer, options);
|
37
82
|
}
|
@@ -39,35 +84,30 @@ class OAuthResolver {
|
|
39
84
|
throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve OAuth server metadata for issuer: ${issuer}`);
|
40
85
|
}
|
41
86
|
}
|
42
|
-
async
|
87
|
+
async getResourceServerMetadata(pdsUrl, options) {
|
43
88
|
try {
|
44
|
-
const rsMetadata = await this.protectedResourceMetadataResolver.get(
|
45
|
-
|
46
|
-
if (
|
47
|
-
throw new oauth_resolver_error_js_1.OAuthResolverError(
|
89
|
+
const rsMetadata = await this.protectedResourceMetadataResolver.get(pdsUrl, options);
|
90
|
+
// ATPROTO requires one, and only one, authorization server entry
|
91
|
+
if (rsMetadata.authorization_servers?.length !== 1) {
|
92
|
+
throw new oauth_resolver_error_js_1.OAuthResolverError(rsMetadata.authorization_servers?.length
|
93
|
+
? `Unable to determine authorization server for PDS: ${pdsUrl}`
|
94
|
+
: `No authorization servers found for PDS: ${pdsUrl}`);
|
48
95
|
}
|
96
|
+
const issuer = rsMetadata.authorization_servers[0];
|
49
97
|
options?.signal?.throwIfAborted();
|
50
|
-
const asMetadata = await this.
|
98
|
+
const asMetadata = await this.getAuthorizationServerMetadata(issuer, options);
|
51
99
|
// https://datatracker.ietf.org/doc/html/draft-ietf-oauth-resource-metadata-05#section-4
|
52
100
|
if (asMetadata.protected_resources) {
|
53
101
|
if (!asMetadata.protected_resources.includes(rsMetadata.resource)) {
|
54
|
-
throw new oauth_resolver_error_js_1.OAuthResolverError(`PDS "${
|
102
|
+
throw new oauth_resolver_error_js_1.OAuthResolverError(`PDS "${pdsUrl}" not protected by issuer "${issuer}"`);
|
55
103
|
}
|
56
104
|
}
|
57
105
|
return asMetadata;
|
58
106
|
}
|
59
107
|
catch (cause) {
|
60
|
-
|
61
|
-
throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve OAuth server metadata for resource: ${pds}`);
|
108
|
+
throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve OAuth server metadata for resource: ${pdsUrl}`);
|
62
109
|
}
|
63
110
|
}
|
64
|
-
async resolve(input, options) {
|
65
|
-
options?.signal?.throwIfAborted();
|
66
|
-
const identity = await this.resolveIdentity(input, options);
|
67
|
-
options?.signal?.throwIfAborted();
|
68
|
-
const metadata = await this.resolvePdsMetadata(identity.pds, options);
|
69
|
-
return { identity, metadata };
|
70
|
-
}
|
71
111
|
}
|
72
112
|
exports.OAuthResolver = OAuthResolver;
|
73
113
|
//# sourceMappingURL=oauth-resolver.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-resolver.js","sourceRoot":"","sources":["../src/oauth-resolver.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"oauth-resolver.js","sourceRoot":"","sources":["../src/oauth-resolver.ts"],"names":[],"mappings":";;;AAKA,sDAG6B;AAO7B,uEAA8D;AAK9D,MAAa,aAAa;IACxB,YACW,gBAAkC,EAClC,iCAAyE,EACzE,mCAA6E;QAFtF;;;;mBAAS,gBAAgB;WAAkB;QAC3C;;;;mBAAS,iCAAiC;WAAwC;QAClF;;;;mBAAS,mCAAmC;WAA0C;IACrF,CAAC;IAEJ;;OAEG;IACI,KAAK,CAAC,OAAO,CAClB,KAAa,EACb,OAA6B;QAK7B,qEAAqE;QACrE,iEAAiE;QACjE,oBAAoB;QACpB,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAA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,EAC5B,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,yBAAQ,EACxB,KAAK,CAAC,EAAE,KAAK;IAaT,MAAM,CAAC,KAAK,EAAE,MAAM;IAQpB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiBhE,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IA6BpD;;;;;;;OAOG;YACW,oBAAoB;IAsC5B,OAAO,CACX,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IACxB,OAAO,CACX,QAAQ,EAAE,8BAA8B,EACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IACtB,OAAO,CACX,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC;IA4BV,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,OAAO,EAAE,yBAAyB,CAAA;KACnC,CAAC;CAsEH"}
|
@@ -175,7 +175,9 @@ class OAuthServerAgent {
|
|
175
175
|
throw new TypeError(`Missing "sub" in token response`);
|
176
176
|
// @TODO (?) make timeout configurable
|
177
177
|
const signal = __addDisposableResource(env_1, (0, util_js_1.timeoutSignal)(10e3), false);
|
178
|
-
const resolved = await this.oauthResolver.
|
178
|
+
const resolved = await this.oauthResolver.resolveFromIdentity(sub, {
|
179
|
+
signal,
|
180
|
+
});
|
179
181
|
if (resolved.metadata.issuer !== this.serverMetadata.issuer) {
|
180
182
|
// Best case scenario; the user switched PDS. Worst case scenario; a bad
|
181
183
|
// actor is trying to impersonate a user. In any case, we must not allow
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-server-agent.js","sourceRoot":"","sources":["../src/oauth-server-agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgF;AAGhF,sDAU6B;AAE7B,iDAA6C;AAC7C,4EAAmE;AACnE,mDAAkD;AAElD,uEAA8D;AAG9D,uCAAyC;AAkBzC,MAAa,gBAAgB;IAG3B,YACW,OAAY,EACZ,cAAgD,EAChD,cAA8B,EAC9B,UAA0B,EAC1B,aAA4B,EAC5B,OAAgB,EAChB,MAAe,EACxB,KAAa;QAPb;;;;mBAAS,OAAO;WAAK;QACrB;;;;mBAAS,cAAc;WAAkC;QACzD;;;;mBAAS,cAAc;WAAgB;QACvC;;;;mBAAS,UAAU;WAAgB;QACnC;;;;mBAAS,aAAa;WAAe;QACrC;;;;mBAAS,OAAO;WAAS;QACzB;;;;mBAAS,MAAM;WAAS;QAThB;;;;;WAAyB;QAYjC,IAAI,CAAC,SAAS,GAAG,IAAA,gCAAgB,EAAO;YACtC,KAAK,EAAE,IAAA,iBAAS,EAAC,KAAK,CAAC;YACvB,GAAG,EAAE,cAAc,CAAC,SAAS;YAC7B,GAAG,EAAE,OAAO;YACZ,aAAa,EAAE,cAAc,CAAC,iCAAiC;YAC/D,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YACtC,MAAM,EAAE,UAAU;YAClB,YAAY,EAAE,IAAI;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,aAAa;QACf,CAAC;IACH,CAAC;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DAAmD,CAAA;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,qBAAa,kBAAkB;IAE3B,QAAQ,CAAC,cAAc,EAAE,cAAc;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO;IACzB,QAAQ,CAAC,QAAQ,EAAE,aAAa;IAChC,QAAQ,CAAC,KAAK,EAAE,KAAK;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IACnC,QAAQ,CAAC,cAAc,EAAE,cAAc;gBAL9B,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,cAAc,EAAE,cAAc;IAGnC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAQnE,YAAY,CAChB,cAAc,EAAE,gCAAgC,EAChD,OAAO,EAAE,GAAG;CAaf"}
|
@@ -42,7 +42,7 @@ class OAuthServerFactory {
|
|
42
42
|
});
|
43
43
|
}
|
44
44
|
async fromIssuer(issuer, dpopKey, options) {
|
45
|
-
const serverMetadata = await this.resolver.
|
45
|
+
const serverMetadata = await this.resolver.getAuthorizationServerMetadata(issuer, options);
|
46
46
|
return this.fromMetadata(serverMetadata, dpopKey);
|
47
47
|
}
|
48
48
|
async fromMetadata(serverMetadata, dpopKey) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-server-factory.js","sourceRoot":"","sources":["../src/oauth-server-factory.ts"],"names":[],"mappings":";;;AAMA,mEAA0E;AAI1E,MAAa,kBAAkB;IAC7B,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AC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAA;IACH,CAAC;CACF;AAjCD,gDAiCC"}
|
package/dist/session-getter.js
CHANGED
@@ -89,7 +89,7 @@ class SessionGetter extends simple_store_1.CachedGetter {
|
|
89
89
|
// concurrency issues if multiple tabs/instances are trying to refresh
|
90
90
|
// the same token. The chances of this happening when multiple instances
|
91
91
|
// are started simultaneously is reduced by randomizing the expiry time
|
92
|
-
// (see isStale()
|
92
|
+
// (see isStale() below). Even so, There still exist chances that
|
93
93
|
// multiple tabs will try to refresh the token at the same time. The
|
94
94
|
// best solution would be to use a mutex/lock to ensure that only one
|
95
95
|
// instance is refreshing the token at a time. A simpler workaround is
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"session-getter.js","sourceRoot":"","sources":["../src/session-getter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAImC;AAGnC,4EAAmE;AACnE,4EAAmE;AACnE,4EAAmE;AACnE,uEAA8D;AAI9D,uCAA4D;AAuB5D;;;;;;GAMG;AACH,MAAa,aAAc,SAAQ,2BAA6B;IAG9D,YACE,YAA0B,EAC1B,aAAiC,EAChB,OAAgB;QAEjC,KAAK,CACH,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,aAAa,EAAoB,EAAE;YACtD,iEAAiE;YACjE,uEAAuE;YACvE,+BAA+B;YAC/B,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChC,mEAAmE;gBACnE,iEAAiE;gBACjE,iEAAiE;gBACjE,mEAAmE;gBACnE,wDAAwD;gBACxD,MAAM,GAAG,GAAG,4CAA4C,CAAA;gBACxD,MAAM,KAAK,GAAG,IAAI,0CAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;gBAC7C,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;gBAC7C,MAAM,KAAK,CAAA;YAC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
"description": "OAuth client for ATPROTO PDS. This package serves as common base for environment-specific implementations (NodeJS, Browser, React-Native).",
|
6
6
|
"keywords": [
|
@@ -27,17 +27,17 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"multiformats": "^9.9.0",
|
29
29
|
"zod": "^3.23.8",
|
30
|
-
"@atproto-labs/did-resolver": "0.1.1",
|
31
|
-
"@atproto-labs/
|
30
|
+
"@atproto-labs/did-resolver": "0.1.2-rc.1",
|
31
|
+
"@atproto-labs/fetch": "0.1.0",
|
32
|
+
"@atproto-labs/handle-resolver": "0.1.2-rc.1",
|
33
|
+
"@atproto-labs/identity-resolver": "0.1.2-rc.1",
|
32
34
|
"@atproto-labs/simple-store": "0.1.1",
|
33
|
-
"@atproto/
|
34
|
-
"@atproto/did": "0.1.
|
35
|
+
"@atproto-labs/simple-store-memory": "0.1.1",
|
36
|
+
"@atproto/did": "0.1.1-rc.1",
|
37
|
+
"@atproto/api": "0.13.0-rc.2",
|
35
38
|
"@atproto/jwk": "0.1.1",
|
36
|
-
"@atproto/oauth-types": "0.1.1",
|
37
|
-
"@atproto/xrpc": "0.
|
38
|
-
"@atproto-labs/identity-resolver": "0.1.1",
|
39
|
-
"@atproto-labs/fetch": "0.1.0",
|
40
|
-
"@atproto-labs/simple-store-memory": "0.1.1"
|
39
|
+
"@atproto/oauth-types": "0.1.2-rc.1",
|
40
|
+
"@atproto/xrpc": "0.5.1-rc.0"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
43
|
"typescript": "^5.3.3"
|
package/src/oauth-atp-agent.ts
CHANGED
@@ -30,9 +30,8 @@ export class OAuthAtpAgent extends Agent {
|
|
30
30
|
})
|
31
31
|
}
|
32
32
|
|
33
|
-
clone():
|
34
|
-
|
35
|
-
return this.copyInto(agent)
|
33
|
+
clone(): OAuthAtpAgent {
|
34
|
+
return this.copyInto(new OAuthAtpAgent(this.oauthAgent))
|
36
35
|
}
|
37
36
|
|
38
37
|
get did(): string {
|
@@ -93,6 +93,14 @@ export class OAuthAuthorizationServerMetadataResolver extends CachedGetter<
|
|
93
93
|
throw new TypeError(`Invalid issuer ${metadata.issuer}`)
|
94
94
|
}
|
95
95
|
|
96
|
+
// ATPROTO requires client_id_metadata_document
|
97
|
+
// http://drafts.aaronpk.com/draft-parecki-oauth-client-id-metadata-document/draft-parecki-oauth-client-id-metadata-document.html
|
98
|
+
if (metadata.client_id_metadata_document_supported !== true) {
|
99
|
+
throw new TypeError(
|
100
|
+
`Authorization server "${issuer}" does not support client_id_metadata_document`,
|
101
|
+
)
|
102
|
+
}
|
103
|
+
|
96
104
|
return metadata
|
97
105
|
}
|
98
106
|
}
|
package/src/oauth-client.ts
CHANGED
@@ -257,16 +257,10 @@ export class OAuthClient extends CustomEventTarget<OAuthClientEventMap> {
|
|
257
257
|
throw new TypeError('Invalid redirect_uri')
|
258
258
|
}
|
259
259
|
|
260
|
-
const
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
// DID)
|
265
|
-
{
|
266
|
-
identity: undefined,
|
267
|
-
metadata: await this.oauthResolver.resolveMetadata(input, { signal }),
|
268
|
-
}
|
269
|
-
: await this.oauthResolver.resolve(input, { signal })
|
260
|
+
const { identity, metadata } = await this.oauthResolver.resolve(
|
261
|
+
input,
|
262
|
+
options,
|
263
|
+
)
|
270
264
|
|
271
265
|
const nonce = await this.runtime.generateNonce()
|
272
266
|
const pkce = await this.runtime.generatePKCE()
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
SimpleStore,
|
11
11
|
} from '@atproto-labs/simple-store'
|
12
12
|
import {
|
13
|
+
ALLOW_UNSECURE_ORIGINS,
|
13
14
|
OAuthProtectedResourceMetadata,
|
14
15
|
oauthProtectedResourceMetadataSchema,
|
15
16
|
} from '@atproto/oauth-types'
|
@@ -45,10 +46,14 @@ export class OAuthProtectedResourceMetadataResolver extends CachedGetter<
|
|
45
46
|
options?: GetCachedOptions,
|
46
47
|
): Promise<OAuthProtectedResourceMetadata> {
|
47
48
|
const { protocol, origin } = new URL(resource)
|
48
|
-
if (
|
49
|
-
|
49
|
+
if (
|
50
|
+
protocol === 'https:' ||
|
51
|
+
(protocol === 'http:' && ALLOW_UNSECURE_ORIGINS)
|
52
|
+
) {
|
53
|
+
return super.get(origin, options)
|
50
54
|
}
|
51
|
-
|
55
|
+
|
56
|
+
throw new TypeError(`Forbidden resource sercure protocol "${protocol}"`)
|
52
57
|
}
|
53
58
|
|
54
59
|
private async fetchMetadata(
|
@@ -62,7 +67,7 @@ export class OAuthProtectedResourceMetadataResolver extends CachedGetter<
|
|
62
67
|
const request = new Request(url, {
|
63
68
|
signal: options?.signal,
|
64
69
|
headers,
|
65
|
-
redirect: '
|
70
|
+
redirect: 'manual', // response must be 200 OK
|
66
71
|
})
|
67
72
|
|
68
73
|
const response = await this.fetch(request)
|
package/src/oauth-resolver.ts
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
import {
|
2
|
-
ResolveIdentityOptions,
|
3
2
|
IdentityResolver,
|
4
3
|
ResolvedIdentity,
|
4
|
+
ResolveIdentityOptions,
|
5
5
|
} from '@atproto-labs/identity-resolver'
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
OAuthAuthorizationServerMetadata,
|
8
|
+
oauthIssuerIdentifierSchema,
|
9
|
+
} from '@atproto/oauth-types'
|
7
10
|
|
8
|
-
import { OAuthResolverError } from './oauth-resolver-error.js'
|
9
11
|
import {
|
10
12
|
GetCachedOptions,
|
11
13
|
OAuthAuthorizationServerMetadataResolver,
|
12
14
|
} from './oauth-authorization-server-metadata-resolver.js'
|
13
15
|
import { OAuthProtectedResourceMetadataResolver } from './oauth-protected-resource-metadata-resolver.js'
|
16
|
+
import { OAuthResolverError } from './oauth-resolver-error.js'
|
14
17
|
|
15
18
|
export type { GetCachedOptions }
|
16
19
|
export type ResolveOAuthOptions = GetCachedOptions & ResolveIdentityOptions
|
@@ -22,6 +25,75 @@ export class OAuthResolver {
|
|
22
25
|
readonly authorizationServerMetadataResolver: OAuthAuthorizationServerMetadataResolver,
|
23
26
|
) {}
|
24
27
|
|
28
|
+
/**
|
29
|
+
* @param input - A handle, DID, PDS URL or Entryway URL
|
30
|
+
*/
|
31
|
+
public async resolve(
|
32
|
+
input: string,
|
33
|
+
options?: ResolveOAuthOptions,
|
34
|
+
): Promise<{
|
35
|
+
identity?: ResolvedIdentity
|
36
|
+
metadata: OAuthAuthorizationServerMetadata
|
37
|
+
}> {
|
38
|
+
// Allow using an entryway, or PDS url, directly as login input (e.g.
|
39
|
+
// when the user forgot their handle, or when the handle does not
|
40
|
+
// resolve to a DID)
|
41
|
+
return /^https?:\/\//.test(input)
|
42
|
+
? this.resolveFromService(input, options)
|
43
|
+
: this.resolveFromIdentity(input, options)
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @note this method can be used to verify if a particular uri supports OAuth
|
48
|
+
* based sign-in (for compatibility with legacy implementation).
|
49
|
+
*/
|
50
|
+
public async resolveFromService(
|
51
|
+
input: string,
|
52
|
+
options?: ResolveOAuthOptions,
|
53
|
+
): Promise<{
|
54
|
+
metadata: OAuthAuthorizationServerMetadata
|
55
|
+
}> {
|
56
|
+
try {
|
57
|
+
// Assume first that input is a PDS URL (as required by ATPROTO)
|
58
|
+
const metadata = await this.getResourceServerMetadata(input, options)
|
59
|
+
return { metadata }
|
60
|
+
} catch (err) {
|
61
|
+
if (!options?.signal?.aborted && err instanceof OAuthResolverError) {
|
62
|
+
try {
|
63
|
+
// Fallback to trying to fetch as an issuer (Entryway)
|
64
|
+
const result = oauthIssuerIdentifierSchema.safeParse(input)
|
65
|
+
if (result.success) {
|
66
|
+
const metadata = await this.getAuthorizationServerMetadata(
|
67
|
+
result.data,
|
68
|
+
options,
|
69
|
+
)
|
70
|
+
return { metadata }
|
71
|
+
}
|
72
|
+
} catch {
|
73
|
+
// Fallback failed, throw original error
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
throw err
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
public async resolveFromIdentity(
|
82
|
+
input: string,
|
83
|
+
options?: ResolveOAuthOptions,
|
84
|
+
): Promise<{
|
85
|
+
identity: ResolvedIdentity
|
86
|
+
metadata: OAuthAuthorizationServerMetadata
|
87
|
+
}> {
|
88
|
+
const identity = await this.resolveIdentity(input, options)
|
89
|
+
|
90
|
+
options?.signal?.throwIfAborted()
|
91
|
+
|
92
|
+
const metadata = await this.getResourceServerMetadata(identity.pds, options)
|
93
|
+
|
94
|
+
return { identity, metadata }
|
95
|
+
}
|
96
|
+
|
25
97
|
public async resolveIdentity(
|
26
98
|
input: string,
|
27
99
|
options?: ResolveIdentityOptions,
|
@@ -36,7 +108,7 @@ export class OAuthResolver {
|
|
36
108
|
}
|
37
109
|
}
|
38
110
|
|
39
|
-
public async
|
111
|
+
public async getAuthorizationServerMetadata(
|
40
112
|
issuer: string,
|
41
113
|
options?: GetCachedOptions,
|
42
114
|
): Promise<OAuthAuthorizationServerMetadata> {
|
@@ -50,62 +122,49 @@ export class OAuthResolver {
|
|
50
122
|
}
|
51
123
|
}
|
52
124
|
|
53
|
-
public async
|
54
|
-
|
125
|
+
public async getResourceServerMetadata(
|
126
|
+
pdsUrl: string | URL,
|
55
127
|
options?: GetCachedOptions,
|
56
128
|
) {
|
57
129
|
try {
|
58
130
|
const rsMetadata = await this.protectedResourceMetadataResolver.get(
|
59
|
-
|
131
|
+
pdsUrl,
|
60
132
|
options,
|
61
133
|
)
|
62
134
|
|
63
|
-
|
64
|
-
if (
|
135
|
+
// ATPROTO requires one, and only one, authorization server entry
|
136
|
+
if (rsMetadata.authorization_servers?.length !== 1) {
|
65
137
|
throw new OAuthResolverError(
|
66
|
-
|
138
|
+
rsMetadata.authorization_servers?.length
|
139
|
+
? `Unable to determine authorization server for PDS: ${pdsUrl}`
|
140
|
+
: `No authorization servers found for PDS: ${pdsUrl}`,
|
67
141
|
)
|
68
142
|
}
|
69
143
|
|
144
|
+
const issuer = rsMetadata.authorization_servers![0]!
|
145
|
+
|
70
146
|
options?.signal?.throwIfAborted()
|
71
147
|
|
72
|
-
const asMetadata = await this.
|
148
|
+
const asMetadata = await this.getAuthorizationServerMetadata(
|
149
|
+
issuer,
|
150
|
+
options,
|
151
|
+
)
|
73
152
|
|
74
153
|
// https://datatracker.ietf.org/doc/html/draft-ietf-oauth-resource-metadata-05#section-4
|
75
154
|
if (asMetadata.protected_resources) {
|
76
155
|
if (!asMetadata.protected_resources.includes(rsMetadata.resource)) {
|
77
156
|
throw new OAuthResolverError(
|
78
|
-
`PDS "${
|
157
|
+
`PDS "${pdsUrl}" not protected by issuer "${issuer}"`,
|
79
158
|
)
|
80
159
|
}
|
81
160
|
}
|
82
161
|
|
83
162
|
return asMetadata
|
84
163
|
} catch (cause) {
|
85
|
-
options?.signal?.throwIfAborted()
|
86
|
-
|
87
164
|
throw OAuthResolverError.from(
|
88
165
|
cause,
|
89
|
-
`Failed to resolve OAuth server metadata for resource: ${
|
166
|
+
`Failed to resolve OAuth server metadata for resource: ${pdsUrl}`,
|
90
167
|
)
|
91
168
|
}
|
92
169
|
}
|
93
|
-
|
94
|
-
public async resolve(
|
95
|
-
input: string,
|
96
|
-
options?: ResolveOAuthOptions,
|
97
|
-
): Promise<{
|
98
|
-
identity: ResolvedIdentity
|
99
|
-
metadata: OAuthAuthorizationServerMetadata
|
100
|
-
}> {
|
101
|
-
options?.signal?.throwIfAborted()
|
102
|
-
|
103
|
-
const identity = await this.resolveIdentity(input, options)
|
104
|
-
|
105
|
-
options?.signal?.throwIfAborted()
|
106
|
-
|
107
|
-
const metadata = await this.resolvePdsMetadata(identity.pds, options)
|
108
|
-
|
109
|
-
return { identity, metadata }
|
110
|
-
}
|
111
170
|
}
|
@@ -134,7 +134,9 @@ export class OAuthServerAgent {
|
|
134
134
|
// @TODO (?) make timeout configurable
|
135
135
|
using signal = timeoutSignal(10e3)
|
136
136
|
|
137
|
-
const resolved = await this.oauthResolver.
|
137
|
+
const resolved = await this.oauthResolver.resolveFromIdentity(sub, {
|
138
|
+
signal,
|
139
|
+
})
|
138
140
|
|
139
141
|
if (resolved.metadata.issuer !== this.serverMetadata.issuer) {
|
140
142
|
// Best case scenario; the user switched PDS. Worst case scenario; a bad
|
@@ -19,7 +19,10 @@ export class OAuthServerFactory {
|
|
19
19
|
) {}
|
20
20
|
|
21
21
|
async fromIssuer(issuer: string, dpopKey: Key, options?: GetCachedOptions) {
|
22
|
-
const serverMetadata = await this.resolver.
|
22
|
+
const serverMetadata = await this.resolver.getAuthorizationServerMetadata(
|
23
|
+
issuer,
|
24
|
+
options,
|
25
|
+
)
|
23
26
|
return this.fromMetadata(serverMetadata, dpopKey)
|
24
27
|
}
|
25
28
|
|
package/src/session-getter.ts
CHANGED
@@ -82,7 +82,7 @@ export class SessionGetter extends CachedGetter<string, Session> {
|
|
82
82
|
// concurrency issues if multiple tabs/instances are trying to refresh
|
83
83
|
// the same token. The chances of this happening when multiple instances
|
84
84
|
// are started simultaneously is reduced by randomizing the expiry time
|
85
|
-
// (see isStale()
|
85
|
+
// (see isStale() below). Even so, There still exist chances that
|
86
86
|
// multiple tabs will try to refresh the token at the same time. The
|
87
87
|
// best solution would be to use a mutex/lock to ensure that only one
|
88
88
|
// instance is refreshing the token at a time. A simpler workaround is
|