@vitemcp/server 1.9.11 → 1.9.13
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 +15 -11
- package/dist/{OAuthProvider-B78zmLtB.d.cts → OAuthProvider-BDDi19HO.d.cts} +15 -3
- package/dist/{OAuthProvider-B78zmLtB.d.ts → OAuthProvider-BDDi19HO.d.ts} +15 -3
- package/dist/ViteMCP.cjs +4 -4
- package/dist/ViteMCP.d.cts +2 -2
- package/dist/ViteMCP.d.ts +2 -2
- package/dist/ViteMCP.js +3 -3
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +7 -2
- package/dist/auth/index.d.ts +7 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-KSEFUQF4.js → chunk-5XM67UD5.js} +35 -6
- package/dist/chunk-5XM67UD5.js.map +1 -0
- package/dist/{chunk-TYR2KJIV.js → chunk-JMDI672G.js} +44 -9
- package/dist/chunk-JMDI672G.js.map +1 -0
- package/dist/{chunk-C2VT2NXC.cjs → chunk-NCSND5TI.cjs} +8 -8
- package/dist/{chunk-C2VT2NXC.cjs.map → chunk-NCSND5TI.cjs.map} +1 -1
- package/dist/{chunk-IAT55CW3.js → chunk-QGWUABBC.js} +3 -3
- package/dist/{chunk-DURXYPPR.cjs → chunk-QPVEGWOL.cjs} +44 -9
- package/dist/chunk-QPVEGWOL.cjs.map +1 -0
- package/dist/{chunk-XGRRYN5Y.cjs → chunk-SKQK3QGJ.cjs} +35 -6
- package/dist/chunk-SKQK3QGJ.cjs.map +1 -0
- package/dist/edge/index.cjs +5 -5
- package/dist/edge/index.js +1 -1
- package/dist/openapi/index.cjs +103 -36
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +2 -2
- package/dist/openapi/index.d.ts +2 -2
- package/dist/openapi/index.js +86 -19
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-DURXYPPR.cjs.map +0 -1
- package/dist/chunk-KSEFUQF4.js.map +0 -1
- package/dist/chunk-TYR2KJIV.js.map +0 -1
- package/dist/chunk-XGRRYN5Y.cjs.map +0 -1
- /package/dist/{chunk-IAT55CW3.js.map → chunk-QGWUABBC.js.map} +0 -0
package/README.md
CHANGED
|
@@ -258,17 +258,21 @@ server.addTool({
|
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
Works for `outputSchema` too, and is advertised as written — as are Zod and
|
|
261
|
-
ArkType schemas, which emit their own JSON Schema.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
`
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
`v.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
261
|
+
ArkType schemas, which emit their own JSON Schema. Where one of those holds
|
|
262
|
+
something JSON Schema cannot express — a `z.date()`, a `z.bigint()`, an ArkType
|
|
263
|
+
`narrow()` — that part alone is advertised as open, as `{}` or as the type a
|
|
264
|
+
`narrow()` narrows, and the library still enforces it. A schema from any other
|
|
265
|
+
library (Valibot, for one) is converted to JSON Schema for `tools/list` only;
|
|
266
|
+
arguments and results are still validated by the library itself, so a
|
|
267
|
+
`v.transform()` reaches `execute` and a `v.check()` is enforced even though
|
|
268
|
+
JSON Schema can express neither. Converted input schemas get
|
|
269
|
+
`additionalProperties: false` on every object, except where a record or rest
|
|
270
|
+
schema (`v.record()`, `v.objectWithRest()`) describes the extra keys, or where
|
|
271
|
+
the keys are declared in the branches of a `v.union()`, `v.variant()` or
|
|
272
|
+
`v.intersect()`, or behind the `$ref` a `v.lazy()` becomes; converted output
|
|
273
|
+
schemas are left as they are. A tool whose schema cannot be converted at all,
|
|
274
|
+
or whose `parameters` do not describe an object, is left out of the server and
|
|
275
|
+
reported through the logger.
|
|
272
276
|
|
|
273
277
|
A plain JSON Schema is validated in the dialect its `$schema` declares —
|
|
274
278
|
2020-12, 2019-09, draft-07 or draft-06 — and as 2020-12 when it declares none,
|
|
@@ -60,6 +60,11 @@ interface ClientCode {
|
|
|
60
60
|
createdAt: Date;
|
|
61
61
|
/** Code expiration timestamp */
|
|
62
62
|
expiresAt: Date;
|
|
63
|
+
/**
|
|
64
|
+
* The redirect URI the code was authorized for. Absent from a code stored by
|
|
65
|
+
* a version that did not record it, which is redeemed without the check.
|
|
66
|
+
*/
|
|
67
|
+
redirectUri?: string;
|
|
63
68
|
transactionId: string;
|
|
64
69
|
/** Upstream tokens obtained from provider */
|
|
65
70
|
upstreamTokens: UpstreamTokenSet;
|
|
@@ -205,7 +210,13 @@ interface OAuthProviderConfig {
|
|
|
205
210
|
* Configuration for the OAuth Proxy
|
|
206
211
|
*/
|
|
207
212
|
interface OAuthProxyConfig {
|
|
208
|
-
/**
|
|
213
|
+
/**
|
|
214
|
+
* Lifetime in seconds of a swapped access token whose upstream token
|
|
215
|
+
* response carries no `expires_in`. A positive one takes precedence, so this
|
|
216
|
+
* does not shorten tokens from a provider that sets it. Without either, the
|
|
217
|
+
* default is 3600 when the upstream issued a refresh token, and 31536000
|
|
218
|
+
* (one year) when it did not.
|
|
219
|
+
*/
|
|
209
220
|
accessTokenTtl?: number;
|
|
210
221
|
/**
|
|
211
222
|
* Allow-list of redirect URI patterns accepted by Dynamic Client Registration.
|
|
@@ -451,7 +462,8 @@ interface TokenRequest {
|
|
|
451
462
|
code: string;
|
|
452
463
|
code_verifier?: string;
|
|
453
464
|
grant_type: "authorization_code";
|
|
454
|
-
|
|
465
|
+
/** Optional: OAuth 2.1 drops it from the token request. */
|
|
466
|
+
redirect_uri?: string;
|
|
455
467
|
}
|
|
456
468
|
/**
|
|
457
469
|
* OAuth token response
|
|
@@ -514,7 +526,7 @@ interface TokenVerifier {
|
|
|
514
526
|
*/
|
|
515
527
|
interface UpstreamTokenSet {
|
|
516
528
|
accessToken: string;
|
|
517
|
-
/** Token expiration in seconds */
|
|
529
|
+
/** Token expiration in seconds; 0 when the upstream did not say */
|
|
518
530
|
expiresIn: number;
|
|
519
531
|
/** ID token (for OIDC) */
|
|
520
532
|
idToken?: string;
|
|
@@ -60,6 +60,11 @@ interface ClientCode {
|
|
|
60
60
|
createdAt: Date;
|
|
61
61
|
/** Code expiration timestamp */
|
|
62
62
|
expiresAt: Date;
|
|
63
|
+
/**
|
|
64
|
+
* The redirect URI the code was authorized for. Absent from a code stored by
|
|
65
|
+
* a version that did not record it, which is redeemed without the check.
|
|
66
|
+
*/
|
|
67
|
+
redirectUri?: string;
|
|
63
68
|
transactionId: string;
|
|
64
69
|
/** Upstream tokens obtained from provider */
|
|
65
70
|
upstreamTokens: UpstreamTokenSet;
|
|
@@ -205,7 +210,13 @@ interface OAuthProviderConfig {
|
|
|
205
210
|
* Configuration for the OAuth Proxy
|
|
206
211
|
*/
|
|
207
212
|
interface OAuthProxyConfig {
|
|
208
|
-
/**
|
|
213
|
+
/**
|
|
214
|
+
* Lifetime in seconds of a swapped access token whose upstream token
|
|
215
|
+
* response carries no `expires_in`. A positive one takes precedence, so this
|
|
216
|
+
* does not shorten tokens from a provider that sets it. Without either, the
|
|
217
|
+
* default is 3600 when the upstream issued a refresh token, and 31536000
|
|
218
|
+
* (one year) when it did not.
|
|
219
|
+
*/
|
|
209
220
|
accessTokenTtl?: number;
|
|
210
221
|
/**
|
|
211
222
|
* Allow-list of redirect URI patterns accepted by Dynamic Client Registration.
|
|
@@ -451,7 +462,8 @@ interface TokenRequest {
|
|
|
451
462
|
code: string;
|
|
452
463
|
code_verifier?: string;
|
|
453
464
|
grant_type: "authorization_code";
|
|
454
|
-
|
|
465
|
+
/** Optional: OAuth 2.1 drops it from the token request. */
|
|
466
|
+
redirect_uri?: string;
|
|
455
467
|
}
|
|
456
468
|
/**
|
|
457
469
|
* OAuth token response
|
|
@@ -514,7 +526,7 @@ interface TokenVerifier {
|
|
|
514
526
|
*/
|
|
515
527
|
interface UpstreamTokenSet {
|
|
516
528
|
accessToken: string;
|
|
517
|
-
/** Token expiration in seconds */
|
|
529
|
+
/** Token expiration in seconds; 0 when the upstream did not say */
|
|
518
530
|
expiresIn: number;
|
|
519
531
|
/** ID token (for OIDC) */
|
|
520
532
|
idToken?: string;
|
package/dist/ViteMCP.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkNCSND5TIcjs = require('./chunk-NCSND5TI.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -25,8 +25,8 @@ var _chunkC2VT2NXCcjs = require('./chunk-C2VT2NXC.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
29
|
-
require('./chunk-
|
|
28
|
+
var _chunkSKQK3QGJcjs = require('./chunk-SKQK3QGJ.cjs');
|
|
29
|
+
require('./chunk-QPVEGWOL.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
@@ -52,5 +52,5 @@ require('./chunk-DURXYPPR.cjs');
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
exports.AuthProvider =
|
|
55
|
+
exports.AuthProvider = _chunkSKQK3QGJcjs.AuthProvider; exports.AzureProvider = _chunkSKQK3QGJcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkNCSND5TIcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkSKQK3QGJcjs.GitHubProvider; exports.GoogleProvider = _chunkSKQK3QGJcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkNCSND5TIcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkSKQK3QGJcjs.OAuthProvider; exports.OAuthProxy = _chunkSKQK3QGJcjs.OAuthProxy; exports.OAuthProxyError = _chunkSKQK3QGJcjs.OAuthProxyError; exports.ServerState = _chunkNCSND5TIcjs.ServerState; exports.UnexpectedStateError = _chunkNCSND5TIcjs.UnexpectedStateError; exports.UserError = _chunkNCSND5TIcjs.UserError; exports.ViteMCP = _chunkNCSND5TIcjs.ViteMCP; exports.ViteMCPError = _chunkNCSND5TIcjs.ViteMCPError; exports.audioContent = _chunkNCSND5TIcjs.audioContent; exports.delay = _chunkNCSND5TIcjs.delay; exports.getAuthSession = _chunkSKQK3QGJcjs.getAuthSession; exports.imageContent = _chunkNCSND5TIcjs.imageContent; exports.jsonSchemaAdapter = _chunkNCSND5TIcjs.jsonSchemaAdapter; exports.requireAll = _chunkSKQK3QGJcjs.requireAll; exports.requireAny = _chunkSKQK3QGJcjs.requireAny; exports.requireAuth = _chunkSKQK3QGJcjs.requireAuth; exports.requireRole = _chunkSKQK3QGJcjs.requireRole; exports.requireScopes = _chunkSKQK3QGJcjs.requireScopes;
|
|
56
56
|
//# sourceMappingURL=ViteMCP.cjs.map
|
package/dist/ViteMCP.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
|
4
4
|
import { Hono } from 'hono';
|
|
5
5
|
import { cors } from 'hono/cors';
|
|
6
6
|
export { setTimeout as delay } from 'timers/promises';
|
|
7
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
8
|
-
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-
|
|
7
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BDDi19HO.cjs';
|
|
8
|
+
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BDDi19HO.cjs';
|
|
9
9
|
|
|
10
10
|
declare class DiscoveryDocumentCache {
|
|
11
11
|
#private;
|
package/dist/ViteMCP.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
|
4
4
|
import { Hono } from 'hono';
|
|
5
5
|
import { cors } from 'hono/cors';
|
|
6
6
|
export { setTimeout as delay } from 'timers/promises';
|
|
7
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
8
|
-
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-
|
|
7
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BDDi19HO.js';
|
|
8
|
+
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BDDi19HO.js';
|
|
9
9
|
|
|
10
10
|
declare class DiscoveryDocumentCache {
|
|
11
11
|
#private;
|
package/dist/ViteMCP.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
delay,
|
|
11
11
|
imageContent,
|
|
12
12
|
jsonSchemaAdapter
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QGWUABBC.js";
|
|
14
14
|
import {
|
|
15
15
|
AuthProvider,
|
|
16
16
|
AzureProvider,
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
requireAuth,
|
|
26
26
|
requireRole,
|
|
27
27
|
requireScopes
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-5XM67UD5.js";
|
|
29
|
+
import "./chunk-JMDI672G.js";
|
|
30
30
|
export {
|
|
31
31
|
AuthProvider,
|
|
32
32
|
AzureProvider,
|
package/dist/auth/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkSKQK3QGJcjs = require('../chunk-SKQK3QGJ.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -51,5 +51,5 @@ var _chunkXGRRYN5Ycjs = require('../chunk-XGRRYN5Y.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
exports.AuthProvider =
|
|
54
|
+
exports.AuthProvider = _chunkSKQK3QGJcjs.AuthProvider; exports.AzureProvider = _chunkSKQK3QGJcjs.AzureProvider; exports.ConsentManager = _chunkSKQK3QGJcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkSKQK3QGJcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkSKQK3QGJcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkSKQK3QGJcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkSKQK3QGJcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkSKQK3QGJcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkSKQK3QGJcjs.DiskStore; exports.EncryptedTokenStorage = _chunkSKQK3QGJcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkSKQK3QGJcjs.GitHubProvider; exports.GoogleProvider = _chunkSKQK3QGJcjs.GoogleProvider; exports.JWKSVerifier = _chunkSKQK3QGJcjs.JWKSVerifier; exports.JWTIssuer = _chunkSKQK3QGJcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkSKQK3QGJcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkSKQK3QGJcjs.OAuthProvider; exports.OAuthProxy = _chunkSKQK3QGJcjs.OAuthProxy; exports.OAuthProxyError = _chunkSKQK3QGJcjs.OAuthProxyError; exports.PKCEUtils = _chunkSKQK3QGJcjs.PKCEUtils; exports.getAuthSession = _chunkSKQK3QGJcjs.getAuthSession; exports.requireAll = _chunkSKQK3QGJcjs.requireAll; exports.requireAny = _chunkSKQK3QGJcjs.requireAny; exports.requireAuth = _chunkSKQK3QGJcjs.requireAuth; exports.requireRole = _chunkSKQK3QGJcjs.requireRole; exports.requireScopes = _chunkSKQK3QGJcjs.requireScopes;
|
|
55
55
|
//# sourceMappingURL=index.cjs.map
|
package/dist/auth/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-
|
|
2
|
-
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BDDi19HO.cjs';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BDDi19HO.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Consent Management
|
|
@@ -18,6 +18,11 @@ declare class ConsentManager {
|
|
|
18
18
|
createConsentResponse(transaction: OAuthTransaction, provider: string): Response;
|
|
19
19
|
/**
|
|
20
20
|
* Generate HTML for consent screen
|
|
21
|
+
*
|
|
22
|
+
* The form posts to `consent`, relative to the page it is on, rather than to
|
|
23
|
+
* `/oauth/consent`. The page is served at `<basePath>/oauth/authorize` with
|
|
24
|
+
* the consent route beside it, so under a base path the rooted address was
|
|
25
|
+
* one no route answers, and Approve came back 404.
|
|
21
26
|
*/
|
|
22
27
|
generateConsentScreen(data: ConsentData): string;
|
|
23
28
|
/**
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-
|
|
2
|
-
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BDDi19HO.js';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BDDi19HO.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Consent Management
|
|
@@ -18,6 +18,11 @@ declare class ConsentManager {
|
|
|
18
18
|
createConsentResponse(transaction: OAuthTransaction, provider: string): Response;
|
|
19
19
|
/**
|
|
20
20
|
* Generate HTML for consent screen
|
|
21
|
+
*
|
|
22
|
+
* The form posts to `consent`, relative to the page it is on, rather than to
|
|
23
|
+
* `/oauth/consent`. The page is served at `<basePath>/oauth/authorize` with
|
|
24
|
+
* the consent route beside it, so under a base path the rooted address was
|
|
25
|
+
* one no route answers, and Approve came back 404.
|
|
21
26
|
*/
|
|
22
27
|
generateConsentScreen(data: ConsentData): string;
|
|
23
28
|
/**
|
package/dist/auth/index.js
CHANGED
|
@@ -378,6 +378,7 @@ var clientCodeStorageSchema = z.object({
|
|
|
378
378
|
codeChallengeMethod: z.string(),
|
|
379
379
|
createdAt: storedDateSchema,
|
|
380
380
|
expiresAt: storedDateSchema,
|
|
381
|
+
redirectUri: z.string().optional(),
|
|
381
382
|
transactionId: z.string(),
|
|
382
383
|
upstreamTokens: upstreamTokenSetStorageSchema,
|
|
383
384
|
used: z.boolean().optional()
|
|
@@ -731,6 +732,11 @@ var ConsentManager = class {
|
|
|
731
732
|
}
|
|
732
733
|
/**
|
|
733
734
|
* Generate HTML for consent screen
|
|
735
|
+
*
|
|
736
|
+
* The form posts to `consent`, relative to the page it is on, rather than to
|
|
737
|
+
* `/oauth/consent`. The page is served at `<basePath>/oauth/authorize` with
|
|
738
|
+
* the consent route beside it, so under a base path the rooted address was
|
|
739
|
+
* one no route answers, and Approve came back 404.
|
|
734
740
|
*/
|
|
735
741
|
generateConsentScreen(data) {
|
|
736
742
|
const { clientName, provider, scope, transactionId } = data;
|
|
@@ -918,7 +924,7 @@ var ConsentManager = class {
|
|
|
918
924
|
</p>
|
|
919
925
|
</div>
|
|
920
926
|
|
|
921
|
-
<form method="POST" action="
|
|
927
|
+
<form method="POST" action="consent">
|
|
922
928
|
<input type="hidden" name="transaction_id" value="${this.escapeHtml(transactionId)}">
|
|
923
929
|
<div class="actions">
|
|
924
930
|
<button type="submit" name="action" value="deny" class="deny">
|
|
@@ -1455,6 +1461,7 @@ var MemoryTokenStorage = class {
|
|
|
1455
1461
|
var withoutTrailingSlash = (url) => url.replace(/\/+$/, "");
|
|
1456
1462
|
|
|
1457
1463
|
// src/auth/OAuthProxy.ts
|
|
1464
|
+
var GITHUB_TOKEN_ENDPOINT = "https://github.com/login/oauth/access_token";
|
|
1458
1465
|
var RESERVED_AUTHORIZATION_PARAMS = /* @__PURE__ */ new Set([
|
|
1459
1466
|
"client_id",
|
|
1460
1467
|
"code_challenge",
|
|
@@ -1650,6 +1657,12 @@ var OAuthProxy = class {
|
|
|
1650
1657
|
"Authorization code was issued to another client"
|
|
1651
1658
|
);
|
|
1652
1659
|
}
|
|
1660
|
+
if (request2.redirect_uri && clientCode.redirectUri !== void 0 && request2.redirect_uri !== clientCode.redirectUri) {
|
|
1661
|
+
throw new OAuthProxyError(
|
|
1662
|
+
"invalid_grant",
|
|
1663
|
+
"redirect_uri does not match the authorization request"
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1653
1666
|
if (!authenticated && (!clientCode.codeChallenge || clientCode.codeChallengeMethod !== "S256")) {
|
|
1654
1667
|
throw new OAuthProxyError(
|
|
1655
1668
|
"invalid_grant",
|
|
@@ -1671,6 +1684,11 @@ var OAuthProxy = class {
|
|
|
1671
1684
|
if (!valid) {
|
|
1672
1685
|
throw new OAuthProxyError("invalid_grant", "Invalid PKCE verifier");
|
|
1673
1686
|
}
|
|
1687
|
+
} else if (request2.code_verifier) {
|
|
1688
|
+
throw new OAuthProxyError(
|
|
1689
|
+
"invalid_request",
|
|
1690
|
+
"code_verifier provided without a code_challenge"
|
|
1691
|
+
);
|
|
1674
1692
|
}
|
|
1675
1693
|
if (this.config.enableTokenSwap && this.jwtIssuer) {
|
|
1676
1694
|
return await this.issueSwappedTokens(
|
|
@@ -1681,7 +1699,7 @@ var OAuthProxy = class {
|
|
|
1681
1699
|
} else {
|
|
1682
1700
|
const response = {
|
|
1683
1701
|
access_token: clientCode.upstreamTokens.accessToken,
|
|
1684
|
-
expires_in: clientCode.upstreamTokens.expiresIn,
|
|
1702
|
+
expires_in: clientCode.upstreamTokens.expiresIn || 3600,
|
|
1685
1703
|
token_type: clientCode.upstreamTokens.tokenType
|
|
1686
1704
|
};
|
|
1687
1705
|
if (clientCode.upstreamTokens.refreshToken) {
|
|
@@ -2083,7 +2101,10 @@ var OAuthProxy = class {
|
|
|
2083
2101
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2084
2102
|
return {
|
|
2085
2103
|
accessToken: tokens.access_token,
|
|
2086
|
-
|
|
2104
|
+
// 0 when the upstream did not say, so `accessTokenTtl` and the defaults
|
|
2105
|
+
// apply. An hour substituted here made every such token look as though
|
|
2106
|
+
// the upstream had set it, and neither was ever reached.
|
|
2107
|
+
expiresIn: tokens.expires_in ?? 0,
|
|
2087
2108
|
idToken: tokens.id_token,
|
|
2088
2109
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2089
2110
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -2175,6 +2196,7 @@ var OAuthProxy = class {
|
|
|
2175
2196
|
expiresAt: new Date(
|
|
2176
2197
|
Date.now() + (this.config.authorizationCodeTtl || 300) * 1e3
|
|
2177
2198
|
),
|
|
2199
|
+
redirectUri: transaction.clientCallbackUrl,
|
|
2178
2200
|
transactionId: transaction.id,
|
|
2179
2201
|
upstreamTokens
|
|
2180
2202
|
};
|
|
@@ -2618,7 +2640,13 @@ var OAuthProxy = class {
|
|
|
2618
2640
|
id_token: z2.string().optional(),
|
|
2619
2641
|
refresh_expires_in: z2.coerce.number().int().positive().optional(),
|
|
2620
2642
|
refresh_token: z2.string().optional(),
|
|
2621
|
-
|
|
2643
|
+
// GitHub lists the scopes it granted with commas, `read:user,user:email`,
|
|
2644
|
+
// which read as one scope that no check matched. RFC 6749 §3.3 separates
|
|
2645
|
+
// scopes with spaces and allows a comma inside one, so only GitHub's are
|
|
2646
|
+
// split.
|
|
2647
|
+
scope: z2.string().transform(
|
|
2648
|
+
(scope) => this.config.upstreamTokenEndpoint === GITHUB_TOKEN_ENDPOINT ? scope.split(/[ ,]+/).filter(Boolean).join(" ") : scope
|
|
2649
|
+
).optional(),
|
|
2622
2650
|
token_type: z2.string().optional()
|
|
2623
2651
|
});
|
|
2624
2652
|
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
@@ -2726,7 +2754,8 @@ var OAuthProxy = class {
|
|
|
2726
2754
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2727
2755
|
return {
|
|
2728
2756
|
accessToken: tokens.access_token,
|
|
2729
|
-
|
|
2757
|
+
// 0 when the upstream did not say, as on the code exchange.
|
|
2758
|
+
expiresIn: tokens.expires_in ?? 0,
|
|
2730
2759
|
idToken: tokens.id_token,
|
|
2731
2760
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2732
2761
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -3656,4 +3685,4 @@ export {
|
|
|
3656
3685
|
DiskStore,
|
|
3657
3686
|
JWKSVerifier
|
|
3658
3687
|
};
|
|
3659
|
-
//# sourceMappingURL=chunk-
|
|
3688
|
+
//# sourceMappingURL=chunk-5XM67UD5.js.map
|