@atproto/oauth-provider 0.1.3 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +35 -0
- package/dist/account/account.d.ts +6 -2
- package/dist/account/account.d.ts.map +1 -1
- package/dist/assets/app/bundle-manifest.json +3 -3
- package/dist/assets/app/main.css +1 -1
- package/dist/assets/app/main.js +1 -1
- package/dist/assets/app/main.js.map +1 -1
- package/dist/assets/assets-middleware.d.ts +2 -1
- package/dist/assets/assets-middleware.d.ts.map +1 -1
- package/dist/assets/assets-middleware.js +7 -0
- package/dist/assets/assets-middleware.js.map +1 -1
- package/dist/client/client-manager.d.ts +4 -3
- package/dist/client/client-manager.d.ts.map +1 -1
- package/dist/client/client-manager.js +60 -37
- package/dist/client/client-manager.js.map +1 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +1 -3
- package/dist/client/client.js.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -1
- package/dist/constants.js.map +1 -1
- package/dist/device/device-manager.d.ts +1 -1
- package/dist/device/device-manager.d.ts.map +1 -1
- package/dist/device/device-manager.js +2 -2
- package/dist/device/device-manager.js.map +1 -1
- package/dist/errors/invalid-authorization-details-error.d.ts +4 -3
- package/dist/errors/invalid-authorization-details-error.d.ts.map +1 -1
- package/dist/errors/invalid-authorization-details-error.js +4 -4
- package/dist/errors/invalid-authorization-details-error.js.map +1 -1
- package/dist/lib/http/request.d.ts +3 -0
- package/dist/lib/http/request.d.ts.map +1 -1
- package/dist/lib/http/request.js +24 -12
- package/dist/lib/http/request.js.map +1 -1
- package/dist/metadata/build-metadata.d.ts +0 -1
- package/dist/metadata/build-metadata.d.ts.map +1 -1
- package/dist/metadata/build-metadata.js +9 -35
- package/dist/metadata/build-metadata.js.map +1 -1
- package/dist/oauth-hooks.d.ts +3 -10
- package/dist/oauth-hooks.d.ts.map +1 -1
- package/dist/oauth-provider.d.ts +8 -13
- package/dist/oauth-provider.d.ts.map +1 -1
- package/dist/oauth-provider.js +169 -109
- package/dist/oauth-provider.js.map +1 -1
- package/dist/oauth-verifier.d.ts +1 -2
- package/dist/oauth-verifier.d.ts.map +1 -1
- package/dist/oauth-verifier.js.map +1 -1
- package/dist/output/build-authorize-data.d.ts +6 -0
- package/dist/output/build-authorize-data.d.ts.map +1 -1
- package/dist/output/build-authorize-data.js +1 -0
- package/dist/output/build-authorize-data.js.map +1 -1
- package/dist/replay/replay-manager.d.ts +1 -0
- package/dist/replay/replay-manager.d.ts.map +1 -1
- package/dist/replay/replay-manager.js +3 -0
- package/dist/replay/replay-manager.js.map +1 -1
- package/dist/replay/replay-store.d.ts +1 -1
- package/dist/request/request-info.d.ts +2 -0
- package/dist/request/request-info.d.ts.map +1 -1
- package/dist/request/request-manager.d.ts +3 -9
- package/dist/request/request-manager.d.ts.map +1 -1
- package/dist/request/request-manager.js +52 -77
- package/dist/request/request-manager.js.map +1 -1
- package/dist/request/types.d.ts +10 -10
- package/dist/signer/signed-token-payload.d.ts +85 -85
- package/dist/signer/signer.d.ts +23 -30
- package/dist/signer/signer.d.ts.map +1 -1
- package/dist/signer/signer.js +0 -40
- package/dist/signer/signer.js.map +1 -1
- package/dist/token/token-claims.d.ts +81 -81
- package/dist/token/token-manager.d.ts +1 -2
- package/dist/token/token-manager.d.ts.map +1 -1
- package/dist/token/token-manager.js +10 -37
- package/dist/token/token-manager.js.map +1 -1
- package/dist/token/types.d.ts +10 -10
- package/package.json +2 -3
- package/src/account/account.ts +11 -7
- package/src/assets/app/backend-data.ts +9 -2
- package/src/assets/app/components/accept-form.tsx +65 -51
- package/src/assets/app/components/client-name.tsx +24 -16
- package/src/assets/app/views/accept-view.tsx +7 -4
- package/src/assets/app/views/authorize-view.tsx +2 -1
- package/src/assets/assets-middleware.ts +14 -2
- package/src/client/client-manager.ts +78 -60
- package/src/client/client.ts +1 -4
- package/src/constants.ts +3 -0
- package/src/device/device-manager.ts +7 -1
- package/src/errors/invalid-authorization-details-error.ts +9 -4
- package/src/lib/http/request.ts +61 -15
- package/src/metadata/build-metadata.ts +9 -42
- package/src/oauth-hooks.ts +3 -13
- package/src/oauth-provider.ts +181 -159
- package/src/oauth-verifier.ts +1 -2
- package/src/output/build-authorize-data.ts +8 -0
- package/src/replay/replay-manager.ts +9 -0
- package/src/replay/replay-store.ts +1 -1
- package/src/request/request-info.ts +2 -0
- package/src/request/request-manager.ts +81 -107
- package/src/signer/signer.ts +0 -63
- package/src/token/token-manager.ts +8 -41
- package/dist/oidc/claims.d.ts +0 -16
- package/dist/oidc/claims.d.ts.map +0 -1
- package/dist/oidc/claims.js +0 -29
- package/dist/oidc/claims.js.map +0 -1
- package/dist/oidc/userinfo.d.ts +0 -7
- package/dist/oidc/userinfo.d.ts.map +0 -1
- package/dist/oidc/userinfo.js +0 -3
- package/dist/oidc/userinfo.js.map +0 -1
- package/dist/parameters/claims-requested.d.ts +0 -3
- package/dist/parameters/claims-requested.d.ts.map +0 -1
- package/dist/parameters/claims-requested.js +0 -77
- package/dist/parameters/claims-requested.js.map +0 -1
- package/dist/parameters/oidc-payload.d.ts +0 -31
- package/dist/parameters/oidc-payload.d.ts.map +0 -1
- package/dist/parameters/oidc-payload.js +0 -25
- package/dist/parameters/oidc-payload.js.map +0 -1
- package/src/assets/app/components/client-identifier.tsx +0 -31
- package/src/oidc/claims.ts +0 -35
- package/src/oidc/userinfo.ts +0 -11
- package/src/parameters/claims-requested.ts +0 -106
- package/src/parameters/oidc-payload.ts +0 -28
@@ -87,6 +87,10 @@ class TokenManager {
|
|
87
87
|
if (!('code_verifier' in input) || !input.code_verifier) {
|
88
88
|
throw new invalid_grant_error_js_1.InvalidGrantError('code_verifier is required');
|
89
89
|
}
|
90
|
+
// Prevent client from generating too short code_verifiers
|
91
|
+
if (input.code_verifier.length < 43) {
|
92
|
+
throw new invalid_grant_error_js_1.InvalidGrantError('code_verifier too short');
|
93
|
+
}
|
90
94
|
switch (parameters.code_challenge_method) {
|
91
95
|
case undefined: // Default is "plain" (per spec)
|
92
96
|
case 'plain': {
|
@@ -121,8 +125,7 @@ class TokenManager {
|
|
121
125
|
}
|
122
126
|
}
|
123
127
|
const tokenId = await (0, token_id_js_1.generateTokenId)();
|
124
|
-
const
|
125
|
-
const refreshToken = scopes?.includes('offline_access')
|
128
|
+
const refreshToken = client.metadata.grant_types.includes('refresh_token')
|
126
129
|
? await (0, refresh_token_js_1.generateRefreshToken)()
|
127
130
|
: undefined;
|
128
131
|
const now = new Date();
|
@@ -153,25 +156,14 @@ class TokenManager {
|
|
153
156
|
cnf: parameters.dpop_jkt ? { jkt: parameters.dpop_jkt } : undefined,
|
154
157
|
authorization_details: authorizationDetails,
|
155
158
|
});
|
156
|
-
|
157
|
-
? await this.signer.idToken(client, parameters, account, {
|
158
|
-
exp: expiresAt,
|
159
|
-
iat: now,
|
160
|
-
// If there is no deviceInfo, we are in a "password_grant" context
|
161
|
-
auth_time: device?.info.authenticatedAt || new Date(),
|
162
|
-
access_token: accessToken,
|
163
|
-
code,
|
164
|
-
})
|
165
|
-
: undefined;
|
166
|
-
return this.buildTokenResponse(client, accessToken, refreshToken, idToken, expiresAt, parameters, account, authorizationDetails);
|
159
|
+
return this.buildTokenResponse(client, accessToken, refreshToken, expiresAt, parameters, account, authorizationDetails);
|
167
160
|
}
|
168
|
-
async buildTokenResponse(client, accessToken, refreshToken,
|
161
|
+
async buildTokenResponse(client, accessToken, refreshToken, expiresAt, parameters, account, authorizationDetails) {
|
169
162
|
const tokenResponse = {
|
170
163
|
access_token: accessToken,
|
171
164
|
token_type: parameters.dpop_jkt ? 'DPoP' : 'Bearer',
|
172
165
|
refresh_token: refreshToken,
|
173
|
-
|
174
|
-
scope: parameters.scope ?? '',
|
166
|
+
scope: parameters.scope,
|
175
167
|
authorization_details: authorizationDetails,
|
176
168
|
get expires_in() {
|
177
169
|
return (0, date_js_1.dateToRelativeSeconds)(expiresAt);
|
@@ -181,11 +173,6 @@ class TokenManager {
|
|
181
173
|
// mechanism.
|
182
174
|
sub: account.sub,
|
183
175
|
};
|
184
|
-
await this.hooks.onTokenResponse?.call(null, tokenResponse, {
|
185
|
-
client,
|
186
|
-
parameters,
|
187
|
-
account,
|
188
|
-
});
|
189
176
|
return tokenResponse;
|
190
177
|
}
|
191
178
|
async validateAccess(client, clientAuth, tokenInfo) {
|
@@ -207,7 +194,7 @@ class TokenManager {
|
|
207
194
|
if (!tokenInfo?.currentRefreshToken) {
|
208
195
|
throw new invalid_grant_error_js_1.InvalidGrantError(`Invalid refresh token`);
|
209
196
|
}
|
210
|
-
const { account,
|
197
|
+
const { account, data } = tokenInfo;
|
211
198
|
const { parameters } = data;
|
212
199
|
try {
|
213
200
|
if (tokenInfo.currentRefreshToken !== input.refresh_token) {
|
@@ -273,21 +260,7 @@ class TokenManager {
|
|
273
260
|
cnf: parameters.dpop_jkt ? { jkt: parameters.dpop_jkt } : undefined,
|
274
261
|
authorization_details,
|
275
262
|
});
|
276
|
-
|
277
|
-
//
|
278
|
-
// > In addition to the response parameters specified by OAuth 2.0, the
|
279
|
-
// > following parameters MUST be included in the response:
|
280
|
-
// > - id_token: ID Token value associated with the authenticated session.
|
281
|
-
const scopes = parameters.scope?.split(' ');
|
282
|
-
const idToken = scopes?.includes('openid')
|
283
|
-
? await this.signer.idToken(client, parameters, account, {
|
284
|
-
exp: expiresAt,
|
285
|
-
iat: now,
|
286
|
-
auth_time: info?.authenticatedAt,
|
287
|
-
access_token: accessToken,
|
288
|
-
})
|
289
|
-
: undefined;
|
290
|
-
return this.buildTokenResponse(client, accessToken, nextRefreshToken, idToken, expiresAt, parameters, account, authorization_details);
|
263
|
+
return this.buildTokenResponse(client, accessToken, nextRefreshToken, expiresAt, parameters, account, authorization_details);
|
291
264
|
}
|
292
265
|
catch (err) {
|
293
266
|
if (err instanceof invalid_request_error_js_1.InvalidRequestError) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"token-manager.js","sourceRoot":"","sources":["../../src/token/token-manager.ts"],"names":[],"mappings":";;;AAAA,sCAAqD;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ACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,aAAa,CACd,CAAA;QAED,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,CAAA;IACjC,CAAC;CACF;AAxhBD,oCAwhBC"}
|
1
|
+
{"version":3,"file":"token-manager.js","sourceRoot":"","sources":["../../src/token/token-manager.ts"],"names":[],"mappings":";;;AAAA,sCAA0C;AAC1C,sDAM6B;AAC7B,6CAAwC;AAExC,+EAAsE;AAKtE,kDAMwB;AAExB,mGAAwF;AACxF,uFAA6E;AAC7E,6EAAoE;AACpE,iFAAwE;AACxE,6EAAoE;AACpE,iDAAwE;AACxE,iEAAgE;AAEhE,gDAA2C;AAE3C,yDAAyE;AAGzE,+CAKsB;AAGtB,qEAIiC;AAMjC,MAAa,YAAY;IAEF;IACA;IACA;IACA;IACA;IALrB,YACqB,KAAiB,EACjB,MAAc,EACd,KAAiB,EACjB,eAAgC,EAChC,cAAc,4BAAa;QAJ3B,UAAK,GAAL,KAAK,CAAY;QACjB,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAY;QACjB,oBAAe,GAAf,eAAe,CAAiB;QAChC,gBAAW,GAAX,WAAW,CAAgB;IAC7C,CAAC;IAEM,iBAAiB,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE;QAC1C,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,CAAA;IACnD,CAAC;IAES,iBAAiB,CAAC,OAAgB;QAC1C,IAAI,IAAI,CAAC,eAAe,KAAK,sCAAe,CAAC,IAAI,EAAE,CAAC;YAClD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,CAAC,GAAG,CAAA;QAC3C,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,KAAK,sCAAe,CAAC,GAAG,CAAA;IACrD,CAAC;IAED,KAAK,CAAC,MAAM,CACV,MAAc,EACd,UAAsB,EACtB,OAAgB,EAChB,MAAwD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,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG;YAC1B,GAAG,EAAE,IAAA,qBAAW,EAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;YAC1C,GAAG,EAAE,IAAA,qBAAW,EAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;YAC1C,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK;YACtC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ;YAClC,GAAG,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;SACpE,CAAA;QAED,MAAM,MAAM,GAAG,IAAA,0CAAiB,EAC9B,KAAK,EACL,KAAK,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,aAAa,CACd,CAAA;QAED,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,CAAA;IACjC,CAAC;CACF;AAvfD,oCAufC"}
|
package/dist/token/types.d.ts
CHANGED
@@ -77,12 +77,12 @@ export declare const refreshGrantRequestSchema: z.ZodIntersection<z.ZodUnion<[z.
|
|
77
77
|
refresh_token: z.ZodEffects<z.ZodString, `ref-${string}`, string>;
|
78
78
|
client_id: z.ZodString;
|
79
79
|
}, "strip", z.ZodTypeAny, {
|
80
|
-
client_id: string;
|
81
80
|
refresh_token: `ref-${string}`;
|
81
|
+
client_id: string;
|
82
82
|
grant_type: "refresh_token";
|
83
83
|
}, {
|
84
|
-
client_id: string;
|
85
84
|
refresh_token: string;
|
85
|
+
client_id: string;
|
86
86
|
grant_type: "refresh_token";
|
87
87
|
}>>;
|
88
88
|
export type RefreshGrantRequest = z.infer<typeof refreshGrantRequestSchema>;
|
@@ -161,12 +161,12 @@ export declare const tokenRequestSchema: z.ZodUnion<[z.ZodIntersection<z.ZodUnio
|
|
161
161
|
refresh_token: z.ZodEffects<z.ZodString, `ref-${string}`, string>;
|
162
162
|
client_id: z.ZodString;
|
163
163
|
}, "strip", z.ZodTypeAny, {
|
164
|
-
client_id: string;
|
165
164
|
refresh_token: `ref-${string}`;
|
165
|
+
client_id: string;
|
166
166
|
grant_type: "refresh_token";
|
167
167
|
}, {
|
168
|
-
client_id: string;
|
169
168
|
refresh_token: string;
|
169
|
+
client_id: string;
|
170
170
|
grant_type: "refresh_token";
|
171
171
|
}>>]>;
|
172
172
|
export type TokenRequest = z.infer<typeof tokenRequestSchema>;
|
@@ -175,10 +175,10 @@ export declare const tokenIdentification: z.ZodObject<{
|
|
175
175
|
token_type_hint: z.ZodOptional<z.ZodEnum<["access_token", "refresh_token"]>>;
|
176
176
|
}, "strip", z.ZodTypeAny, {
|
177
177
|
token: string;
|
178
|
-
token_type_hint?: "
|
178
|
+
token_type_hint?: "refresh_token" | "access_token" | undefined;
|
179
179
|
}, {
|
180
180
|
token: string;
|
181
|
-
token_type_hint?: "
|
181
|
+
token_type_hint?: "refresh_token" | "access_token" | undefined;
|
182
182
|
}>;
|
183
183
|
export type TokenIdentification = z.infer<typeof tokenIdentification>;
|
184
184
|
export declare const revokeSchema: z.ZodObject<{
|
@@ -186,10 +186,10 @@ export declare const revokeSchema: z.ZodObject<{
|
|
186
186
|
token_type_hint: z.ZodOptional<z.ZodEnum<["access_token", "refresh_token"]>>;
|
187
187
|
}, "strip", z.ZodTypeAny, {
|
188
188
|
token: string;
|
189
|
-
token_type_hint?: "
|
189
|
+
token_type_hint?: "refresh_token" | "access_token" | undefined;
|
190
190
|
}, {
|
191
191
|
token: string;
|
192
|
-
token_type_hint?: "
|
192
|
+
token_type_hint?: "refresh_token" | "access_token" | undefined;
|
193
193
|
}>;
|
194
194
|
export type Revoke = z.infer<typeof revokeSchema>;
|
195
195
|
export declare const introspectSchema: z.ZodIntersection<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
@@ -224,10 +224,10 @@ export declare const introspectSchema: z.ZodIntersection<z.ZodUnion<[z.ZodUnion<
|
|
224
224
|
token_type_hint: z.ZodOptional<z.ZodEnum<["access_token", "refresh_token"]>>;
|
225
225
|
}, "strip", z.ZodTypeAny, {
|
226
226
|
token: string;
|
227
|
-
token_type_hint?: "
|
227
|
+
token_type_hint?: "refresh_token" | "access_token" | undefined;
|
228
228
|
}, {
|
229
229
|
token: string;
|
230
|
-
token_type_hint?: "
|
230
|
+
token_type_hint?: "refresh_token" | "access_token" | undefined;
|
231
231
|
}>>;
|
232
232
|
export type Introspect = z.infer<typeof introspectSchema>;
|
233
233
|
export type IntrospectionResponse = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/oauth-provider",
|
3
|
-
"version": "0.1
|
3
|
+
"version": "0.2.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Generic OAuth2 and OpenID Connect provider for Node.js. Currently only supports features needed for Atproto.",
|
6
6
|
"keywords": [
|
@@ -36,7 +36,6 @@
|
|
36
36
|
"ioredis": "^5.3.2",
|
37
37
|
"jose": "^5.2.0",
|
38
38
|
"keygrip": "^1.1.0",
|
39
|
-
"oidc-token-hash": "^5.0.3",
|
40
39
|
"psl": "^1.9.0",
|
41
40
|
"zod": "^3.23.8",
|
42
41
|
"@atproto-labs/fetch": "0.1.0",
|
@@ -46,7 +45,7 @@
|
|
46
45
|
"@atproto-labs/simple-store-memory": "0.1.1",
|
47
46
|
"@atproto/jwk": "0.1.1",
|
48
47
|
"@atproto/jwk-jose": "0.1.2",
|
49
|
-
"@atproto/oauth-types": "0.1.
|
48
|
+
"@atproto/oauth-types": "0.1.4"
|
50
49
|
},
|
51
50
|
"devDependencies": {
|
52
51
|
"@rollup/plugin-commonjs": "^25.0.7",
|
package/src/account/account.ts
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
import { OIDCStandardPayload } from '../oidc/claims.js'
|
2
1
|
import { Sub } from '../oidc/sub.js'
|
3
2
|
import { Simplify } from '../lib/util/type.js'
|
4
3
|
|
5
|
-
export type Account = Simplify<
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
export type Account = Simplify<{
|
5
|
+
sub: Sub // Account id
|
6
|
+
aud: string | [string, ...string[]] // Resource server URL
|
7
|
+
|
8
|
+
// OIDC inspired
|
9
|
+
preferred_username?: string
|
10
|
+
email?: string
|
11
|
+
email_verified?: boolean
|
12
|
+
picture?: string
|
13
|
+
name?: string
|
14
|
+
}>
|
@@ -14,6 +14,7 @@ export type Account = {
|
|
14
14
|
|
15
15
|
export type Session = {
|
16
16
|
account: Account
|
17
|
+
info?: never // Prevent relying on this in the frontend
|
17
18
|
|
18
19
|
selected: boolean
|
19
20
|
loginRequired: boolean
|
@@ -37,15 +38,21 @@ export type ErrorData = {
|
|
37
38
|
error_description: string
|
38
39
|
}
|
39
40
|
|
41
|
+
export type ScopeDetail = {
|
42
|
+
scope: string
|
43
|
+
description?: string
|
44
|
+
}
|
45
|
+
|
40
46
|
export type AuthorizeData = {
|
41
47
|
clientId: string
|
42
48
|
clientMetadata: OAuthClientMetadata
|
43
49
|
clientTrusted: boolean
|
44
50
|
requestUri: string
|
45
51
|
csrfCookie: string
|
46
|
-
sessions: Session[]
|
47
|
-
newSessionsRequireConsent: boolean
|
48
52
|
loginHint?: string
|
53
|
+
scopeDetails?: ScopeDetail[]
|
54
|
+
newSessionsRequireConsent: boolean
|
55
|
+
sessions: Session[]
|
49
56
|
}
|
50
57
|
|
51
58
|
// see "declareBackendData()" in the backend
|
@@ -1,22 +1,23 @@
|
|
1
1
|
import { OAuthClientMetadata } from '@atproto/oauth-types'
|
2
2
|
import { FormEvent } from 'react'
|
3
3
|
|
4
|
-
import { Account } from '../backend-data'
|
4
|
+
import { Account, ScopeDetail } from '../backend-data'
|
5
5
|
import { Override } from '../lib/util'
|
6
6
|
import { AccountIdentifier } from './account-identifier'
|
7
7
|
import { Button } from './button'
|
8
|
-
import { ClientIdentifier } from './client-identifier'
|
9
8
|
import { ClientName } from './client-name'
|
10
9
|
import { FormCard, FormCardProps } from './form-card'
|
11
|
-
import { Fieldset } from './fieldset'
|
12
10
|
|
13
11
|
export type AcceptFormProps = Override<
|
14
12
|
FormCardProps,
|
15
13
|
{
|
16
|
-
account: Account
|
17
14
|
clientId: string
|
18
15
|
clientMetadata: OAuthClientMetadata
|
19
16
|
clientTrusted: boolean
|
17
|
+
|
18
|
+
account: Account
|
19
|
+
scopeDetails?: ScopeDetail[]
|
20
|
+
|
20
21
|
onAccept: () => void
|
21
22
|
acceptLabel?: string
|
22
23
|
|
@@ -29,10 +30,13 @@ export type AcceptFormProps = Override<
|
|
29
30
|
>
|
30
31
|
|
31
32
|
export function AcceptForm({
|
32
|
-
account,
|
33
33
|
clientId,
|
34
34
|
clientMetadata,
|
35
35
|
clientTrusted,
|
36
|
+
|
37
|
+
account,
|
38
|
+
scopeDetails,
|
39
|
+
|
36
40
|
onAccept,
|
37
41
|
acceptLabel = 'Accept',
|
38
42
|
onReject,
|
@@ -62,54 +66,64 @@ export function AcceptForm({
|
|
62
66
|
}
|
63
67
|
{...props}
|
64
68
|
>
|
65
|
-
|
66
|
-
|
67
|
-
<
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
)
|
69
|
+
{clientTrusted && clientMetadata.logo_uri && (
|
70
|
+
<div key="logo" className="flex items-center justify-center">
|
71
|
+
<img
|
72
|
+
crossOrigin="anonymous"
|
73
|
+
src={clientMetadata.logo_uri}
|
74
|
+
alt={clientMetadata.client_name}
|
75
|
+
className="w-16 h-16 rounded-full"
|
76
|
+
/>
|
77
|
+
</div>
|
78
|
+
)}
|
79
|
+
<p>
|
80
|
+
<ClientName clientId={clientId} clientMetadata={clientMetadata} /> is
|
81
|
+
asking for permission to access your account (
|
82
|
+
<AccountIdentifier account={account} />
|
83
|
+
).
|
84
|
+
</p>
|
80
85
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
<p>
|
87
|
+
By clicking <b>{acceptLabel}</b>, you allow this application to perform
|
88
|
+
the following actions in accordance to their{' '}
|
89
|
+
<a
|
90
|
+
href={clientMetadata.tos_uri}
|
91
|
+
rel="nofollow noopener"
|
92
|
+
target="_blank"
|
93
|
+
className="text-brand underline"
|
94
|
+
>
|
95
|
+
terms of service
|
96
|
+
</a>
|
97
|
+
{' and '}
|
98
|
+
<a
|
99
|
+
href={clientMetadata.policy_uri}
|
100
|
+
rel="nofollow noopener"
|
101
|
+
target="_blank"
|
102
|
+
className="text-brand underline"
|
103
|
+
>
|
104
|
+
privacy policy
|
105
|
+
</a>
|
106
|
+
:
|
107
|
+
</p>
|
89
108
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
terms of service
|
100
|
-
</a>
|
101
|
-
{' and '}
|
102
|
-
<a
|
103
|
-
href={clientMetadata.policy_uri}
|
104
|
-
rel="nofollow noopener"
|
105
|
-
target="_blank"
|
106
|
-
className="text-brand underline"
|
107
|
-
>
|
108
|
-
privacy policy
|
109
|
-
</a>
|
110
|
-
.
|
111
|
-
</p>
|
112
|
-
</Fieldset>
|
109
|
+
{scopeDetails?.length ? (
|
110
|
+
<ul className="list-disc list-inside">
|
111
|
+
{scopeDetails.map(
|
112
|
+
({ scope, description = getScopeDescription(scope) }) => (
|
113
|
+
<li key={scope}>{description}</li>
|
114
|
+
),
|
115
|
+
)}
|
116
|
+
</ul>
|
117
|
+
) : null}
|
113
118
|
</FormCard>
|
114
119
|
)
|
115
120
|
}
|
121
|
+
|
122
|
+
function getScopeDescription(scope: string): string {
|
123
|
+
switch (scope) {
|
124
|
+
case 'atproto':
|
125
|
+
return 'Uniquely identify you'
|
126
|
+
default:
|
127
|
+
return scope
|
128
|
+
}
|
129
|
+
}
|
@@ -1,30 +1,38 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
isOAuthClientIdDiscoverable,
|
3
|
+
isOAuthClientIdLoopback,
|
4
|
+
OAuthClientMetadata,
|
5
|
+
} from '@atproto/oauth-types'
|
2
6
|
import { HTMLAttributes } from 'react'
|
3
7
|
|
4
|
-
import {
|
8
|
+
import { UrlViewer } from './url-viewer'
|
5
9
|
|
6
10
|
export type ClientNameProps = {
|
7
11
|
clientId: string
|
8
12
|
clientMetadata: OAuthClientMetadata
|
9
|
-
|
10
|
-
}
|
13
|
+
} & HTMLAttributes<Element>
|
11
14
|
|
12
15
|
export function ClientName({
|
13
16
|
clientId,
|
14
17
|
clientMetadata,
|
15
|
-
as: As = 'span',
|
16
18
|
...attrs
|
17
|
-
}: ClientNameProps
|
18
|
-
if (
|
19
|
-
return <
|
19
|
+
}: ClientNameProps) {
|
20
|
+
if (isOAuthClientIdLoopback(clientId)) {
|
21
|
+
return <span {...attrs}>An application on your device</span>
|
22
|
+
}
|
23
|
+
|
24
|
+
if (isOAuthClientIdDiscoverable(clientId)) {
|
25
|
+
if (clientMetadata.client_name) {
|
26
|
+
return (
|
27
|
+
<span {...attrs}>
|
28
|
+
{clientMetadata.client_name} (
|
29
|
+
<UrlViewer url={clientId} path />)
|
30
|
+
</span>
|
31
|
+
)
|
32
|
+
}
|
33
|
+
|
34
|
+
return <UrlViewer {...attrs} url={clientId} path />
|
20
35
|
}
|
21
36
|
|
22
|
-
return
|
23
|
-
<ClientIdentifier
|
24
|
-
clientId={clientId}
|
25
|
-
clientMetadata={clientMetadata}
|
26
|
-
as={As}
|
27
|
-
{...attrs}
|
28
|
-
/>
|
29
|
-
)
|
37
|
+
return <span {...attrs}>{clientMetadata.client_name || clientId}</span>
|
30
38
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { OAuthClientMetadata } from '@atproto/oauth-types'
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { Account, ScopeDetail } from '../backend-data'
|
4
4
|
import { AcceptForm } from '../components/accept-form'
|
5
5
|
import { LayoutTitlePage } from '../components/layout-title-page'
|
6
6
|
|
@@ -8,7 +8,9 @@ export type AcceptViewProps = {
|
|
8
8
|
clientId: string
|
9
9
|
clientMetadata: OAuthClientMetadata
|
10
10
|
clientTrusted: boolean
|
11
|
-
|
11
|
+
|
12
|
+
account: Account
|
13
|
+
scopeDetails?: ScopeDetail[]
|
12
14
|
|
13
15
|
onAccept: () => void
|
14
16
|
onReject: () => void
|
@@ -19,12 +21,12 @@ export function AcceptView({
|
|
19
21
|
clientId,
|
20
22
|
clientMetadata,
|
21
23
|
clientTrusted,
|
22
|
-
|
24
|
+
account,
|
25
|
+
scopeDetails,
|
23
26
|
onAccept,
|
24
27
|
onReject,
|
25
28
|
onBack,
|
26
29
|
}: AcceptViewProps) {
|
27
|
-
const { account } = session
|
28
30
|
return (
|
29
31
|
<LayoutTitlePage
|
30
32
|
title="Authorize"
|
@@ -43,6 +45,7 @@ export function AcceptView({
|
|
43
45
|
clientMetadata={clientMetadata}
|
44
46
|
clientTrusted={clientTrusted}
|
45
47
|
account={account}
|
48
|
+
scopeDetails={scopeDetails}
|
46
49
|
onBack={onBack}
|
47
50
|
onAccept={onAccept}
|
48
51
|
onReject={onReject}
|
@@ -79,10 +79,11 @@ export function AuthorizeView({
|
|
79
79
|
if (view === 'accept' && session) {
|
80
80
|
return (
|
81
81
|
<AcceptView
|
82
|
-
session={session}
|
83
82
|
clientId={authorizeData.clientId}
|
84
83
|
clientMetadata={authorizeData.clientMetadata}
|
85
84
|
clientTrusted={authorizeData.clientTrusted}
|
85
|
+
account={session.account}
|
86
|
+
scopeDetails={authorizeData.scopeDetails}
|
86
87
|
onAccept={() => doAccept(session.account)}
|
87
88
|
onReject={doReject}
|
88
89
|
onBack={
|
@@ -1,8 +1,13 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
Middleware,
|
3
|
+
validateFetchDest,
|
4
|
+
validateFetchSite,
|
5
|
+
writeStream,
|
6
|
+
} from '../lib/http/index.js'
|
2
7
|
|
3
8
|
import { ASSETS_URL_PREFIX, getAsset } from './index.js'
|
4
9
|
|
5
|
-
export function authorizeAssetsMiddleware() {
|
10
|
+
export function authorizeAssetsMiddleware(): Middleware {
|
6
11
|
return async function assetsMiddleware(req, res, next): Promise<void> {
|
7
12
|
if (req.method !== 'GET' && req.method !== 'HEAD') return next()
|
8
13
|
if (!req.url?.startsWith(ASSETS_URL_PREFIX)) return next()
|
@@ -17,6 +22,13 @@ export function authorizeAssetsMiddleware() {
|
|
17
22
|
const asset = await getAsset(filename).catch(() => null)
|
18
23
|
if (!asset) return next()
|
19
24
|
|
25
|
+
try {
|
26
|
+
validateFetchSite(req, res, ['same-origin'])
|
27
|
+
validateFetchDest(req, res, ['style', 'script'])
|
28
|
+
} catch (err) {
|
29
|
+
return next(err)
|
30
|
+
}
|
31
|
+
|
20
32
|
if (req.headers['if-none-match'] === asset.sha256) {
|
21
33
|
return void res.writeHead(304).end()
|
22
34
|
}
|