@authfn/oauth-provider 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1
- package/dist/authorize/index.d.ts +5 -0
- package/dist/authorize/index.d.ts.map +1 -0
- package/dist/authorize/index.js +247 -0
- package/dist/authorize/index.js.map +1 -0
- package/dist/http.d.ts +35 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +161 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/introspection/index.d.ts +13 -0
- package/dist/introspection/index.d.ts.map +1 -0
- package/dist/introspection/index.js +47 -0
- package/dist/introspection/index.js.map +1 -0
- package/dist/metadata/index.d.ts +10 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +38 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/pkce.d.ts +4 -0
- package/dist/pkce.d.ts.map +1 -0
- package/dist/pkce.js +17 -0
- package/dist/pkce.js.map +1 -0
- package/dist/revocation/index.d.ts +12 -0
- package/dist/revocation/index.d.ts.map +1 -0
- package/dist/revocation/index.js +34 -0
- package/dist/revocation/index.js.map +1 -0
- package/dist/runtime.d.ts +57 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +226 -0
- package/dist/runtime.js.map +1 -0
- package/dist/store.d.ts +155 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +465 -0
- package/dist/store.js.map +1 -0
- package/dist/token/code.d.ts +11 -0
- package/dist/token/code.d.ts.map +1 -0
- package/dist/token/code.js +64 -0
- package/dist/token/code.js.map +1 -0
- package/dist/token/index.d.ts +5 -0
- package/dist/token/index.d.ts.map +1 -0
- package/dist/token/index.js +39 -0
- package/dist/token/index.js.map +1 -0
- package/dist/token/refresh.d.ts +10 -0
- package/dist/token/refresh.d.ts.map +1 -0
- package/dist/token/refresh.js +47 -0
- package/dist/token/refresh.js.map +1 -0
- package/dist/types.d.ts +177 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,8BAA8B,EAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,sBAAsB,EAAmB,MAAM,YAAY,CAAC;AAC9G,cAAc,YAAY,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAoC,EAAE;IAEtC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,yBAAyB,EAAE;QAC1D,cAAc,EAAE,CAAC,aAAa,EAAE,EAAE;YAChC,8BAA8B,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC;QACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;YACd,MAAM,OAAO,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAC;YAChD,OAAO;gBACL,mBAAmB,CAAC,OAAO,CAAC;gBAC5B,GAAG,qBAAqB,CAAC,OAAO,CAAC;gBACjC,gBAAgB,CAAC,OAAO,CAAC;gBACzB,qBAAqB,CAAC,OAAO,CAAC;gBAC9B,wBAAwB,CAAC,OAAO,CAAC;aAClC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Route } from '@superfunctions/http';
|
|
2
|
+
import type { OAuthProviderRuntime } from '../runtime.js';
|
|
3
|
+
export declare const OAUTH_INTROSPECTION_PATH = "/oauth/introspect";
|
|
4
|
+
/**
|
|
5
|
+
* Token introspection (RFC 7662) for resource servers. The caller
|
|
6
|
+
* authenticates with its resource's introspection secret, and a token is
|
|
7
|
+
* reported active only when it is an active access token issued for that
|
|
8
|
+
* resource: a token presented at the wrong audience is inactive. The optional
|
|
9
|
+
* `iss` is omitted: tokens do not record the issuer they were issued under,
|
|
10
|
+
* and a request-dependent environment could resolve a different one.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createIntrospectionRoute(runtime: OAuthProviderRuntime): Route;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/introspection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAWlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAE5D;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,KAAK,CAmC7E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createAuthFnRouteMeta } from 'authfn/http/router';
|
|
2
|
+
import { handleOAuth, OAuthError, oauthJson, readBearerToken, readFormBody, requireParam, secretsEqual } from '../http.js';
|
|
3
|
+
import { loadActiveToken } from '../store.js';
|
|
4
|
+
export const OAUTH_INTROSPECTION_PATH = '/oauth/introspect';
|
|
5
|
+
/**
|
|
6
|
+
* Token introspection (RFC 7662) for resource servers. The caller
|
|
7
|
+
* authenticates with its resource's introspection secret, and a token is
|
|
8
|
+
* reported active only when it is an active access token issued for that
|
|
9
|
+
* resource: a token presented at the wrong audience is inactive. The optional
|
|
10
|
+
* `iss` is omitted: tokens do not record the issuer they were issued under,
|
|
11
|
+
* and a request-dependent environment could resolve a different one.
|
|
12
|
+
*/
|
|
13
|
+
export function createIntrospectionRoute(runtime) {
|
|
14
|
+
return {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: OAUTH_INTROSPECTION_PATH,
|
|
17
|
+
meta: createAuthFnRouteMeta('oauthIntrospect', 'OAuth 2.0 token introspection', { mode: 'bearer' }),
|
|
18
|
+
handler: (request) => handleOAuth(async () => {
|
|
19
|
+
const secret = readBearerToken(request);
|
|
20
|
+
const caller = secret === null
|
|
21
|
+
? undefined
|
|
22
|
+
: runtime.config.resources.find((resource) => resource.introspectionSecret !== undefined && secretsEqual(secret, resource.introspectionSecret));
|
|
23
|
+
if (!caller) {
|
|
24
|
+
throw new OAuthError('invalid_token', 'Resource server authentication failed', 401, {
|
|
25
|
+
'www-authenticate': 'Bearer error="invalid_token"'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const params = await readFormBody(request);
|
|
29
|
+
const active = await loadActiveToken(runtime.store, requireParam(params, 'token'), 'access', runtime.now());
|
|
30
|
+
if (!active || active.record.resource !== caller.resource) {
|
|
31
|
+
return oauthJson({ active: false });
|
|
32
|
+
}
|
|
33
|
+
const { record } = active;
|
|
34
|
+
return oauthJson({
|
|
35
|
+
active: true,
|
|
36
|
+
scope: record.scopes.join(' '),
|
|
37
|
+
client_id: record.clientId,
|
|
38
|
+
sub: record.userId,
|
|
39
|
+
aud: record.resource,
|
|
40
|
+
token_type: 'Bearer',
|
|
41
|
+
iat: Math.floor(record.createdAt.getTime() / 1000),
|
|
42
|
+
exp: Math.floor(record.expiresAt.getTime() / 1000)
|
|
43
|
+
});
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/introspection/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAA6B;IACpE,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,qBAAqB,CAAC,iBAAiB,EAAE,+BAA+B,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACnG,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;YAC3C,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,MAAM,KAAK,IAAI;gBAC5B,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC3C,QAAQ,CAAC,mBAAmB,KAAK,SAA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|
+
import type { Route } from '@superfunctions/http';
|
|
2
|
+
import { type OAuthProviderRuntime } from '../runtime.js';
|
|
3
|
+
export declare const OAUTH_METADATA_PATH = "/.well-known/oauth-authorization-server";
|
|
4
|
+
/**
|
|
5
|
+
* RFC 8414 authorization server metadata. Served under the AuthFn base path;
|
|
6
|
+
* hosts route `/.well-known/oauth-authorization-server` (with the issuer's
|
|
7
|
+
* path appended, if any) to this route.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createMetadataRoute(runtime: OAuthProviderRuntime): Route;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5E,eAAO,MAAM,mBAAmB,4CAA4C,CAAC;AAE7E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,KAAK,CA4BxE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createAuthFnRouteMeta } from 'authfn/http/router';
|
|
2
|
+
import { resolveEndpoints } from '../runtime.js';
|
|
3
|
+
export const OAUTH_METADATA_PATH = '/.well-known/oauth-authorization-server';
|
|
4
|
+
/**
|
|
5
|
+
* RFC 8414 authorization server metadata. Served under the AuthFn base path;
|
|
6
|
+
* hosts route `/.well-known/oauth-authorization-server` (with the issuer's
|
|
7
|
+
* path appended, if any) to this route.
|
|
8
|
+
*/
|
|
9
|
+
export function createMetadataRoute(runtime) {
|
|
10
|
+
return {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
path: OAUTH_METADATA_PATH,
|
|
13
|
+
meta: createAuthFnRouteMeta('oauthAuthorizationServerMetadata', 'OAuth 2.1 authorization server metadata', {
|
|
14
|
+
mode: 'none'
|
|
15
|
+
}),
|
|
16
|
+
handler: async (request) => {
|
|
17
|
+
const endpoints = await resolveEndpoints(runtime, request);
|
|
18
|
+
const scopes = [...new Set(runtime.config.resources.flatMap((resource) => resource.scopes))];
|
|
19
|
+
return Response.json({
|
|
20
|
+
issuer: endpoints.issuer,
|
|
21
|
+
authorization_endpoint: endpoints.authorization,
|
|
22
|
+
token_endpoint: endpoints.token,
|
|
23
|
+
revocation_endpoint: endpoints.revocation,
|
|
24
|
+
introspection_endpoint: endpoints.introspection,
|
|
25
|
+
scopes_supported: scopes,
|
|
26
|
+
response_types_supported: ['code'],
|
|
27
|
+
response_modes_supported: ['query'],
|
|
28
|
+
grant_types_supported: ['authorization_code', 'refresh_token'],
|
|
29
|
+
code_challenge_methods_supported: ['S256'],
|
|
30
|
+
token_endpoint_auth_methods_supported: ['none', 'client_secret_basic', 'client_secret_post'],
|
|
31
|
+
revocation_endpoint_auth_methods_supported: ['none', 'client_secret_basic', 'client_secret_post'],
|
|
32
|
+
introspection_endpoint_auth_methods_supported: ['bearer'],
|
|
33
|
+
authorization_response_iss_parameter_supported: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAA6B,MAAM,eAAe,CAAC;AAE5E,MAAM,CAAC,MAAM,mBAAmB,GAAG,yCAAyC,CAAC;AAE7E;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,qBAAqB,CAAC,kCAAkC,EAAE,yCAAyC,EAAE;YACzG,IAAI,EAAE,MAAM;SACb,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACzB,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC3D,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC7F,OAAO,QAAQ,CAAC,IAAI,CAAC;gBACnB,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,sBAAsB,EAAE,SAAS,CAAC,aAAa;gBAC/C,cAAc,EAAE,SAAS,CAAC,KAAK;gBAC/B,mBAAmB,EAAE,SAAS,CAAC,UAAU;gBACzC,sBAAsB,EAAE,SAAS,CAAC,aAAa;gBAC/C,gBAAgB,EAAE,MAAM;gBACxB,wBAAwB,EAAE,CAAC,MAAM,CAAC;gBAClC,wBAAwB,EAAE,CAAC,OAAO,CAAC;gBACnC,qBAAqB,EAAE,CAAC,oBAAoB,EAAE,eAAe,CAAC;gBAC9D,gCAAgC,EAAE,CAAC,MAAM,CAAC;gBAC1C,qCAAqC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,oBAAoB,CAAC;gBAC5F,0CAA0C,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,oBAAoB,CAAC;gBACjG,6CAA6C,EAAE,CAAC,QAAQ,CAAC;gBACzD,8CAA8C,EAAE,IAAI;aACrD,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/pkce.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isS256Challenge(value: string): boolean;
|
|
2
|
+
/** RFC 7636 4.6: BASE64URL-ENCODE(SHA256(ASCII(code_verifier))) == code_challenge. */
|
|
3
|
+
export declare function verifyS256(verifier: string, challenge: string): boolean;
|
|
4
|
+
//# sourceMappingURL=pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../src/pkce.ts"],"names":[],"mappings":"AAQA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAKvE"}
|
package/dist/pkce.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { secretsEqual } from './http.js';
|
|
3
|
+
// RFC 7636 4.1: code_verifier = 43*128unreserved.
|
|
4
|
+
const CODE_VERIFIER = /^[A-Za-z0-9\-._~]{43,128}$/;
|
|
5
|
+
// BASE64URL(SHA256(verifier)) is always 43 characters without padding.
|
|
6
|
+
const S256_CHALLENGE = /^[A-Za-z0-9\-_]{43}$/;
|
|
7
|
+
export function isS256Challenge(value) {
|
|
8
|
+
return S256_CHALLENGE.test(value);
|
|
9
|
+
}
|
|
10
|
+
/** RFC 7636 4.6: BASE64URL-ENCODE(SHA256(ASCII(code_verifier))) == code_challenge. */
|
|
11
|
+
export function verifyS256(verifier, challenge) {
|
|
12
|
+
if (!CODE_VERIFIER.test(verifier)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return secretsEqual(createHash('sha256').update(verifier, 'ascii').digest('base64url'), challenge);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=pkce.js.map
|
package/dist/pkce.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.js","sourceRoot":"","sources":["../src/pkce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,kDAAkD;AAClD,MAAM,aAAa,GAAG,4BAA4B,CAAC;AACnD,uEAAuE;AACvE,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,UAAU,CAAC,QAAgB,EAAE,SAAiB;IAC5D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Route } from '@superfunctions/http';
|
|
2
|
+
import type { OAuthProviderRuntime } from '../runtime.js';
|
|
3
|
+
export declare const OAUTH_REVOCATION_PATH = "/oauth/revoke";
|
|
4
|
+
/**
|
|
5
|
+
* Token revocation (RFC 7009). Revoking a refresh token revokes its whole
|
|
6
|
+
* grant, including every access token issued under it (2.1); revoking an
|
|
7
|
+
* access token revokes only that token. An unknown token, or one issued to
|
|
8
|
+
* another client, is answered with 200 and left untouched (2.2), so the
|
|
9
|
+
* endpoint never reveals whether a token exists.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createRevocationRoute(runtime: OAuthProviderRuntime): Route;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/revocation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,KAAK,CAoB1E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createAuthFnRouteMeta } from 'authfn/http/router';
|
|
2
|
+
import { authenticateClient, handleOAuth, requireParam, readFormBody } from '../http.js';
|
|
3
|
+
import { findToken, revokeGrant, revokeToken } from '../store.js';
|
|
4
|
+
export const OAUTH_REVOCATION_PATH = '/oauth/revoke';
|
|
5
|
+
/**
|
|
6
|
+
* Token revocation (RFC 7009). Revoking a refresh token revokes its whole
|
|
7
|
+
* grant, including every access token issued under it (2.1); revoking an
|
|
8
|
+
* access token revokes only that token. An unknown token, or one issued to
|
|
9
|
+
* another client, is answered with 200 and left untouched (2.2), so the
|
|
10
|
+
* endpoint never reveals whether a token exists.
|
|
11
|
+
*/
|
|
12
|
+
export function createRevocationRoute(runtime) {
|
|
13
|
+
return {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
path: OAUTH_REVOCATION_PATH,
|
|
16
|
+
meta: createAuthFnRouteMeta('oauthRevoke', 'OAuth 2.0 token revocation', { mode: 'none' }),
|
|
17
|
+
handler: (request) => handleOAuth(async () => {
|
|
18
|
+
const params = await readFormBody(request);
|
|
19
|
+
const client = authenticateClient(runtime, request, params);
|
|
20
|
+
const record = await findToken(runtime.store, requireParam(params, 'token'));
|
|
21
|
+
if (record?.clientId === client.clientId) {
|
|
22
|
+
const now = runtime.now();
|
|
23
|
+
if (record.kind === 'refresh') {
|
|
24
|
+
await revokeGrant(runtime.store, record.grantId, 'revoked', now);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
await revokeToken(runtime.store, record.id, now);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return new Response(null, { status: 200, headers: { 'cache-control': 'no-store' } });
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|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AAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;YACD,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QACvF,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AuthFnPluginRuntimeContext, AuthFnRuntimeConfig } from 'authfn';
|
|
2
|
+
import type { OAuthProviderClient, OAuthProviderPluginRuntimeConfig, OAuthProviderResource } from './types.js';
|
|
3
|
+
export declare const OAUTH_PROVIDER_PLUGIN_NAME = "oauthProvider";
|
|
4
|
+
/** Shared state every endpoint reads: validated config, lookups and storage scope. */
|
|
5
|
+
export interface OAuthProviderRuntime {
|
|
6
|
+
ctx: AuthFnPluginRuntimeContext;
|
|
7
|
+
config: OAuthProviderPluginRuntimeConfig;
|
|
8
|
+
store: {
|
|
9
|
+
database: AuthFnRuntimeConfig['database'];
|
|
10
|
+
namespace: string;
|
|
11
|
+
};
|
|
12
|
+
now(): Date;
|
|
13
|
+
findClient(clientId: string): OAuthProviderClient | undefined;
|
|
14
|
+
findResource(resource: string): OAuthProviderResource | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function createOAuthProviderRuntime(ctx: AuthFnPluginRuntimeContext): OAuthProviderRuntime;
|
|
17
|
+
/**
|
|
18
|
+
* Reads and validates `pluginRuntime.oauthProvider`. Runs when the server is
|
|
19
|
+
* created, so a misconfigured provider fails at startup with
|
|
20
|
+
* `AUTHFN_CONFIG_INVALID` rather than on the first authorization.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readOAuthProviderRuntimeConfig(config: AuthFnRuntimeConfig): OAuthProviderPluginRuntimeConfig;
|
|
23
|
+
/**
|
|
24
|
+
* A redirect URI that keeps the authorization response off plaintext
|
|
25
|
+
* networks and out of the browser's own schemes (OAuth 2.1 2.3.1, RFC 8252
|
|
26
|
+
* 7), written in visible ASCII: `https`, `http` only to a loopback IP literal, or a native app's
|
|
27
|
+
* reverse-domain private-use scheme. Every other scheme (`javascript`,
|
|
28
|
+
* `data`, `file`, `ws`, a dotless custom scheme, ...) is rejected. Its query
|
|
29
|
+
* must not use a response parameter name, which the response would otherwise
|
|
30
|
+
* duplicate.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isAllowedRedirectUri(value: unknown): value is string;
|
|
33
|
+
export declare function isAbsoluteUriWithoutFragment(value: unknown): value is string;
|
|
34
|
+
/**
|
|
35
|
+
* Exact redirect URI matching (OAuth 2.1), except that an `http` loopback IP
|
|
36
|
+
* redirect URI matches on any port (RFC 8252 7.3).
|
|
37
|
+
*/
|
|
38
|
+
export declare function matchesRedirectUri(client: OAuthProviderClient, redirectUri: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the requested scopes for a resource (RFC 6749 3.3). An absent
|
|
41
|
+
* `scope` asks for every scope the resource offers. Each requested scope must
|
|
42
|
+
* be one the resource offers, compared exactly.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveRequestedScopes(resource: OAuthProviderResource, scope: string | undefined): string[];
|
|
45
|
+
/** Resolves the single resource (RFC 8707) a request is bound to. */
|
|
46
|
+
export declare function requireResource(runtime: OAuthProviderRuntime, value: string | undefined): OAuthProviderResource;
|
|
47
|
+
export interface OAuthEndpoints {
|
|
48
|
+
issuer: string;
|
|
49
|
+
authorization: string;
|
|
50
|
+
token: string;
|
|
51
|
+
revocation: string;
|
|
52
|
+
introspection: string;
|
|
53
|
+
}
|
|
54
|
+
/** Removes trailing slashes in linear time. */
|
|
55
|
+
export declare function trimTrailingSlashes(value: string): string;
|
|
56
|
+
export declare function resolveEndpoints(runtime: OAuthProviderRuntime, request: Request): Promise<OAuthEndpoints>;
|
|
57
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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;AACrE,wBAAgB,eAAe,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,qBAAqB,CAS/G;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,+CAA+C;AAC/C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAU/G"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { AuthFnConfigError } from 'authfn/core/errors';
|
|
2
|
+
import { readPluginRuntimeConfig } from 'authfn/core/plugin-runtime';
|
|
3
|
+
import { resolveEnvironment } from 'authfn/core/environment';
|
|
4
|
+
import { assertRegisteredScopes } from 'authfn/core/scopes';
|
|
5
|
+
import { isBearerCredential, OAuthError } from './http.js';
|
|
6
|
+
export const OAUTH_PROVIDER_PLUGIN_NAME = 'oauthProvider';
|
|
7
|
+
export function createOAuthProviderRuntime(ctx) {
|
|
8
|
+
const config = readOAuthProviderRuntimeConfig(ctx.config);
|
|
9
|
+
const clients = new Map(config.clients.map((client) => [client.clientId, client]));
|
|
10
|
+
const resources = new Map(config.resources.map((resource) => [resource.resource, resource]));
|
|
11
|
+
return {
|
|
12
|
+
ctx,
|
|
13
|
+
config,
|
|
14
|
+
store: { database: ctx.config.database, namespace: ctx.namespace },
|
|
15
|
+
now: () => config.now?.() ?? new Date(),
|
|
16
|
+
findClient: (clientId) => clients.get(clientId),
|
|
17
|
+
findResource: (resource) => resources.get(resource)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads and validates `pluginRuntime.oauthProvider`. Runs when the server is
|
|
22
|
+
* created, so a misconfigured provider fails at startup with
|
|
23
|
+
* `AUTHFN_CONFIG_INVALID` rather than on the first authorization.
|
|
24
|
+
*/
|
|
25
|
+
export function readOAuthProviderRuntimeConfig(config) {
|
|
26
|
+
const runtime = readPluginRuntimeConfig(config, OAUTH_PROVIDER_PLUGIN_NAME);
|
|
27
|
+
if (typeof runtime.loginRequired !== 'function' || typeof runtime.consent !== 'function') {
|
|
28
|
+
throw configError('pluginRuntime.oauthProvider needs loginRequired and consent hooks');
|
|
29
|
+
}
|
|
30
|
+
if (!Array.isArray(runtime.clients) || !Array.isArray(runtime.resources) || runtime.resources.length === 0) {
|
|
31
|
+
throw configError('pluginRuntime.oauthProvider needs clients and at least one resource');
|
|
32
|
+
}
|
|
33
|
+
const clientIds = new Set();
|
|
34
|
+
for (const client of runtime.clients) {
|
|
35
|
+
validateClient(client, clientIds);
|
|
36
|
+
}
|
|
37
|
+
const resourceIds = new Set();
|
|
38
|
+
const introspectionSecrets = new Set();
|
|
39
|
+
for (const resource of runtime.resources) {
|
|
40
|
+
validateResource(config, resource, resourceIds, introspectionSecrets);
|
|
41
|
+
}
|
|
42
|
+
return runtime;
|
|
43
|
+
}
|
|
44
|
+
function validateClient(client, clientIds) {
|
|
45
|
+
if (typeof client?.clientId !== 'string' || client.clientId.length === 0 || clientIds.has(client.clientId)) {
|
|
46
|
+
throw configError('Each OAuth client needs a unique clientId');
|
|
47
|
+
}
|
|
48
|
+
clientIds.add(client.clientId);
|
|
49
|
+
if (!Array.isArray(client.redirectUris) || client.redirectUris.length === 0 ||
|
|
50
|
+
!client.redirectUris.every(isAllowedRedirectUri)) {
|
|
51
|
+
throw configError(`OAuth client ${client.clientId} needs absolute redirect URIs without a fragment, using https, an http ` +
|
|
52
|
+
'loopback IP or a reverse-domain native app scheme, whose query has no OAuth response parameter');
|
|
53
|
+
}
|
|
54
|
+
const method = client.tokenEndpointAuthMethod;
|
|
55
|
+
if (method !== undefined && !['none', 'client_secret_basic', 'client_secret_post'].includes(method)) {
|
|
56
|
+
throw configError(`OAuth client ${client.clientId} has an unsupported token endpoint auth method`);
|
|
57
|
+
}
|
|
58
|
+
if ((method === 'none' && client.clientSecret) || (method && method !== 'none' && !client.clientSecret)) {
|
|
59
|
+
throw configError(`OAuth client ${client.clientId} auth method and clientSecret disagree`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function validateResource(config, resource, resourceIds, introspectionSecrets) {
|
|
63
|
+
if (!isAbsoluteUriWithoutFragment(resource?.resource) || resourceIds.has(resource.resource)) {
|
|
64
|
+
throw configError('Each OAuth resource must be a unique absolute URI without a fragment');
|
|
65
|
+
}
|
|
66
|
+
resourceIds.add(resource.resource);
|
|
67
|
+
// Introspection identifies the calling resource server by its secret, so
|
|
68
|
+
// a shared secret would make one resource answer for another's audience.
|
|
69
|
+
// The secret is sent as a Bearer credential, so it must fit that grammar.
|
|
70
|
+
const secret = resource.introspectionSecret;
|
|
71
|
+
if (secret !== undefined) {
|
|
72
|
+
if (typeof secret !== 'string' || !isBearerCredential(secret) || introspectionSecrets.has(secret)) {
|
|
73
|
+
throw configError(`OAuth resource ${resource.resource} needs a unique Bearer-token introspectionSecret`);
|
|
74
|
+
}
|
|
75
|
+
introspectionSecrets.add(secret);
|
|
76
|
+
}
|
|
77
|
+
if (!Array.isArray(resource.scopes) || resource.scopes.length === 0) {
|
|
78
|
+
throw configError(`OAuth resource ${resource.resource} needs at least one scope`);
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
assertRegisteredScopes(config.scopes, resource.scopes);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
throw configError(`OAuth resource ${resource.resource} scopes must be grantable by the AuthFn scope registry`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const LOOPBACK_HOSTS = new Set(['127.0.0.1', '[::1]']);
|
|
88
|
+
/** Parameters the authorization response adds to the redirect URI. */
|
|
89
|
+
const RESPONSE_PARAMETERS = ['code', 'state', 'iss', 'error', 'error_description', 'error_uri'];
|
|
90
|
+
/**
|
|
91
|
+
* Only visible ASCII (RFC 3986 URIs, with non-ASCII hosts in punycode and
|
|
92
|
+
* other characters percent-encoded): the redirect URI is sent as is in the
|
|
93
|
+
* `Location` header, which carries no spaces, controls or raw Unicode.
|
|
94
|
+
*/
|
|
95
|
+
function isVisibleAscii(value) {
|
|
96
|
+
return /^[\x21-\x7e]+$/.test(value);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A private-use URI scheme in reverse domain name form (RFC 8252 7.1), such
|
|
100
|
+
* as `com.example.app:`. The dot is outside both character classes, so
|
|
101
|
+
* matching is linear.
|
|
102
|
+
*/
|
|
103
|
+
const PRIVATE_USE_SCHEME = /^[a-z][a-z0-9+-]*(?:\.[a-z0-9+-]+)+:$/;
|
|
104
|
+
/**
|
|
105
|
+
* A redirect URI that keeps the authorization response off plaintext
|
|
106
|
+
* networks and out of the browser's own schemes (OAuth 2.1 2.3.1, RFC 8252
|
|
107
|
+
* 7), written in visible ASCII: `https`, `http` only to a loopback IP literal, or a native app's
|
|
108
|
+
* reverse-domain private-use scheme. Every other scheme (`javascript`,
|
|
109
|
+
* `data`, `file`, `ws`, a dotless custom scheme, ...) is rejected. Its query
|
|
110
|
+
* must not use a response parameter name, which the response would otherwise
|
|
111
|
+
* duplicate.
|
|
112
|
+
*/
|
|
113
|
+
export function isAllowedRedirectUri(value) {
|
|
114
|
+
if (!isAbsoluteUriWithoutFragment(value) || !isVisibleAscii(value)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const url = new URL(value);
|
|
118
|
+
const allowedScheme = url.protocol === 'https:' ? startsWithOrigin(value, url)
|
|
119
|
+
: url.protocol === 'http:' ? LOOPBACK_HOSTS.has(url.hostname) && startsWithOrigin(value, url)
|
|
120
|
+
: PRIVATE_USE_SCHEME.test(url.protocol);
|
|
121
|
+
return allowedScheme && RESPONSE_PARAMETERS.every((name) => !url.searchParams.has(name));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The raw value begins with its own origin, `scheme://host[:port]`. The
|
|
125
|
+
* redirect is sent as written, and a browser resolves forms the URL parser
|
|
126
|
+
* repairs (`https:host/cb`, `https:/host/cb`, backslashes, userinfo)
|
|
127
|
+
* differently or relative to the authorization page.
|
|
128
|
+
*/
|
|
129
|
+
function startsWithOrigin(value, url) {
|
|
130
|
+
return value.slice(0, url.origin.length).toLowerCase() === url.origin.toLowerCase();
|
|
131
|
+
}
|
|
132
|
+
function configError(message) {
|
|
133
|
+
return new AuthFnConfigError(message);
|
|
134
|
+
}
|
|
135
|
+
export function isAbsoluteUriWithoutFragment(value) {
|
|
136
|
+
if (typeof value !== 'string' || value.includes('#')) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
return Boolean(new URL(value));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Exact redirect URI matching (OAuth 2.1), except that an `http` loopback IP
|
|
148
|
+
* redirect URI matches on any port (RFC 8252 7.3).
|
|
149
|
+
*/
|
|
150
|
+
export function matchesRedirectUri(client, redirectUri) {
|
|
151
|
+
// The URL parser drops tabs and newlines, so check the raw value first.
|
|
152
|
+
if (!isVisibleAscii(redirectUri)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
if (client.redirectUris.includes(redirectUri)) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
const requested = parseLoopback(redirectUri);
|
|
159
|
+
return requested !== null && client.redirectUris.some((registered) => {
|
|
160
|
+
const candidate = parseLoopback(registered);
|
|
161
|
+
return candidate !== null &&
|
|
162
|
+
candidate.hostname === requested.hostname &&
|
|
163
|
+
candidate.pathname === requested.pathname &&
|
|
164
|
+
candidate.search === requested.search;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function parseLoopback(value) {
|
|
168
|
+
try {
|
|
169
|
+
const url = new URL(value);
|
|
170
|
+
return url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname) && !value.includes('#') &&
|
|
171
|
+
startsWithOrigin(value, url) ? url : null;
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Resolves the requested scopes for a resource (RFC 6749 3.3). An absent
|
|
179
|
+
* `scope` asks for every scope the resource offers. Each requested scope must
|
|
180
|
+
* be one the resource offers, compared exactly.
|
|
181
|
+
*/
|
|
182
|
+
export function resolveRequestedScopes(resource, scope) {
|
|
183
|
+
if (scope === undefined) {
|
|
184
|
+
return [...resource.scopes];
|
|
185
|
+
}
|
|
186
|
+
const requested = scope.split(' ');
|
|
187
|
+
if (requested.some((entry) => entry.length === 0)) {
|
|
188
|
+
throw new OAuthError('invalid_scope', 'Scope must be space-delimited scope tokens');
|
|
189
|
+
}
|
|
190
|
+
const unknown = requested.filter((entry) => !resource.scopes.includes(entry));
|
|
191
|
+
if (unknown.length > 0) {
|
|
192
|
+
throw new OAuthError('invalid_scope', `Scope is not available for this resource: ${unknown.join(' ')}`);
|
|
193
|
+
}
|
|
194
|
+
return [...new Set(requested)];
|
|
195
|
+
}
|
|
196
|
+
/** Resolves the single resource (RFC 8707) a request is bound to. */
|
|
197
|
+
export function requireResource(runtime, value) {
|
|
198
|
+
if (!value) {
|
|
199
|
+
throw new OAuthError('invalid_target', 'Parameter resource is required');
|
|
200
|
+
}
|
|
201
|
+
const resource = runtime.findResource(value);
|
|
202
|
+
if (!resource) {
|
|
203
|
+
throw new OAuthError('invalid_target', 'Resource is not served by this authorization server');
|
|
204
|
+
}
|
|
205
|
+
return resource;
|
|
206
|
+
}
|
|
207
|
+
/** Removes trailing slashes in linear time. */
|
|
208
|
+
export function trimTrailingSlashes(value) {
|
|
209
|
+
let end = value.length;
|
|
210
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) {
|
|
211
|
+
end -= 1;
|
|
212
|
+
}
|
|
213
|
+
return value.slice(0, end);
|
|
214
|
+
}
|
|
215
|
+
export async function resolveEndpoints(runtime, request) {
|
|
216
|
+
const environment = await resolveEnvironment(runtime.ctx.config, request);
|
|
217
|
+
const base = `${trimTrailingSlashes(environment.baseUrl)}${trimTrailingSlashes(runtime.ctx.basePath)}/oauth`;
|
|
218
|
+
return {
|
|
219
|
+
issuer: environment.issuer,
|
|
220
|
+
authorization: `${base}/authorize`,
|
|
221
|
+
token: `${base}/token`,
|
|
222
|
+
revocation: `${base}/revoke`,
|
|
223
|
+
introspection: `${base}/introspect`
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAO3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAY1D,MAAM,UAAU,0BAA0B,CAAC,GAA+B;IACxE,MAAM,MAAM,GAAG,8BAA8B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACnF,MAAM,SAAS,GAAG,IAAI,GAAG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