@vitemcp/server 1.9.12 → 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/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 +3 -3
- package/dist/ViteMCP.d.cts +2 -2
- package/dist/ViteMCP.d.ts +2 -2
- package/dist/ViteMCP.js +2 -2
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-NZ34AKP4.js → chunk-5XM67UD5.js} +29 -5
- package/dist/chunk-5XM67UD5.js.map +1 -0
- package/dist/{chunk-7T5D57AM.cjs → chunk-NCSND5TI.cjs} +3 -3
- package/dist/{chunk-7T5D57AM.cjs.map → chunk-NCSND5TI.cjs.map} +1 -1
- package/dist/{chunk-WBP37JPX.js → chunk-QGWUABBC.js} +2 -2
- package/dist/{chunk-2X4JCSQQ.cjs → chunk-SKQK3QGJ.cjs} +29 -5
- package/dist/chunk-SKQK3QGJ.cjs.map +1 -0
- package/dist/openapi/index.cjs +99 -35
- 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 +82 -18
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2X4JCSQQ.cjs.map +0 -1
- package/dist/chunk-NZ34AKP4.js.map +0 -1
- /package/dist/{chunk-WBP37JPX.js.map → chunk-QGWUABBC.js.map} +0 -0
|
@@ -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,7 +25,7 @@ var _chunk7T5D57AMcjs = require('./chunk-7T5D57AM.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkSKQK3QGJcjs = require('./chunk-SKQK3QGJ.cjs');
|
|
29
29
|
require('./chunk-QPVEGWOL.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
@@ -52,5 +52,5 @@ require('./chunk-QPVEGWOL.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,7 +25,7 @@ import {
|
|
|
25
25
|
requireAuth,
|
|
26
26
|
requireRole,
|
|
27
27
|
requireScopes
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-5XM67UD5.js";
|
|
29
29
|
import "./chunk-JMDI672G.js";
|
|
30
30
|
export {
|
|
31
31
|
AuthProvider,
|
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 _chunk2X4JCSQQcjs = require('../chunk-2X4JCSQQ.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
|
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
|
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()
|
|
@@ -1460,6 +1461,7 @@ var MemoryTokenStorage = class {
|
|
|
1460
1461
|
var withoutTrailingSlash = (url) => url.replace(/\/+$/, "");
|
|
1461
1462
|
|
|
1462
1463
|
// src/auth/OAuthProxy.ts
|
|
1464
|
+
var GITHUB_TOKEN_ENDPOINT = "https://github.com/login/oauth/access_token";
|
|
1463
1465
|
var RESERVED_AUTHORIZATION_PARAMS = /* @__PURE__ */ new Set([
|
|
1464
1466
|
"client_id",
|
|
1465
1467
|
"code_challenge",
|
|
@@ -1655,6 +1657,12 @@ var OAuthProxy = class {
|
|
|
1655
1657
|
"Authorization code was issued to another client"
|
|
1656
1658
|
);
|
|
1657
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
|
+
}
|
|
1658
1666
|
if (!authenticated && (!clientCode.codeChallenge || clientCode.codeChallengeMethod !== "S256")) {
|
|
1659
1667
|
throw new OAuthProxyError(
|
|
1660
1668
|
"invalid_grant",
|
|
@@ -1676,6 +1684,11 @@ var OAuthProxy = class {
|
|
|
1676
1684
|
if (!valid) {
|
|
1677
1685
|
throw new OAuthProxyError("invalid_grant", "Invalid PKCE verifier");
|
|
1678
1686
|
}
|
|
1687
|
+
} else if (request2.code_verifier) {
|
|
1688
|
+
throw new OAuthProxyError(
|
|
1689
|
+
"invalid_request",
|
|
1690
|
+
"code_verifier provided without a code_challenge"
|
|
1691
|
+
);
|
|
1679
1692
|
}
|
|
1680
1693
|
if (this.config.enableTokenSwap && this.jwtIssuer) {
|
|
1681
1694
|
return await this.issueSwappedTokens(
|
|
@@ -1686,7 +1699,7 @@ var OAuthProxy = class {
|
|
|
1686
1699
|
} else {
|
|
1687
1700
|
const response = {
|
|
1688
1701
|
access_token: clientCode.upstreamTokens.accessToken,
|
|
1689
|
-
expires_in: clientCode.upstreamTokens.expiresIn,
|
|
1702
|
+
expires_in: clientCode.upstreamTokens.expiresIn || 3600,
|
|
1690
1703
|
token_type: clientCode.upstreamTokens.tokenType
|
|
1691
1704
|
};
|
|
1692
1705
|
if (clientCode.upstreamTokens.refreshToken) {
|
|
@@ -2088,7 +2101,10 @@ var OAuthProxy = class {
|
|
|
2088
2101
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2089
2102
|
return {
|
|
2090
2103
|
accessToken: tokens.access_token,
|
|
2091
|
-
|
|
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,
|
|
2092
2108
|
idToken: tokens.id_token,
|
|
2093
2109
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2094
2110
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -2180,6 +2196,7 @@ var OAuthProxy = class {
|
|
|
2180
2196
|
expiresAt: new Date(
|
|
2181
2197
|
Date.now() + (this.config.authorizationCodeTtl || 300) * 1e3
|
|
2182
2198
|
),
|
|
2199
|
+
redirectUri: transaction.clientCallbackUrl,
|
|
2183
2200
|
transactionId: transaction.id,
|
|
2184
2201
|
upstreamTokens
|
|
2185
2202
|
};
|
|
@@ -2623,7 +2640,13 @@ var OAuthProxy = class {
|
|
|
2623
2640
|
id_token: z2.string().optional(),
|
|
2624
2641
|
refresh_expires_in: z2.coerce.number().int().positive().optional(),
|
|
2625
2642
|
refresh_token: z2.string().optional(),
|
|
2626
|
-
|
|
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(),
|
|
2627
2650
|
token_type: z2.string().optional()
|
|
2628
2651
|
});
|
|
2629
2652
|
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
@@ -2731,7 +2754,8 @@ var OAuthProxy = class {
|
|
|
2731
2754
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2732
2755
|
return {
|
|
2733
2756
|
accessToken: tokens.access_token,
|
|
2734
|
-
|
|
2757
|
+
// 0 when the upstream did not say, as on the code exchange.
|
|
2758
|
+
expiresIn: tokens.expires_in ?? 0,
|
|
2735
2759
|
idToken: tokens.id_token,
|
|
2736
2760
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2737
2761
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -3661,4 +3685,4 @@ export {
|
|
|
3661
3685
|
DiskStore,
|
|
3662
3686
|
JWKSVerifier
|
|
3663
3687
|
};
|
|
3664
|
-
//# sourceMappingURL=chunk-
|
|
3688
|
+
//# sourceMappingURL=chunk-5XM67UD5.js.map
|