fastmcp 4.26.2 → 4.28.0
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/FastMCP.cjs +4 -4
- package/dist/FastMCP.d.cts +2 -2
- package/dist/FastMCP.d.ts +2 -2
- package/dist/FastMCP.js +3 -3
- package/dist/{OAuthProvider-B7VDZGyx.d.cts → OAuthProvider-BnQsqcsL.d.cts} +13 -3
- package/dist/{OAuthProvider-B7VDZGyx.d.ts → OAuthProvider-BnQsqcsL.d.ts} +13 -3
- 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-2NZFMD6I.cjs +120 -0
- package/dist/chunk-2NZFMD6I.cjs.map +1 -0
- package/dist/{chunk-W6P57SNV.js → chunk-4ZSNKIR3.js} +37 -5
- package/dist/chunk-4ZSNKIR3.js.map +1 -0
- package/dist/{chunk-UULT6NOS.cjs → chunk-AAPHX5IG.cjs} +28 -13
- package/dist/chunk-AAPHX5IG.cjs.map +1 -0
- package/dist/chunk-AM3HVK4Z.js +120 -0
- package/dist/chunk-AM3HVK4Z.js.map +1 -0
- package/dist/{chunk-ASOZUCE2.js → chunk-EI3KPYSZ.js} +22 -7
- package/dist/chunk-EI3KPYSZ.js.map +1 -0
- package/dist/{chunk-HVKGDRTL.cjs → chunk-VVAKRLCY.cjs} +37 -5
- package/dist/chunk-VVAKRLCY.cjs.map +1 -0
- package/dist/edge/index.cjs +61 -43
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.d.cts +0 -6
- package/dist/edge/index.d.ts +0 -6
- package/dist/edge/index.js +59 -41
- package/dist/edge/index.js.map +1 -1
- package/dist/examples/custom-routes.cjs +4 -4
- package/dist/examples/custom-routes.js +3 -3
- package/dist/openapi/index.cjs +98 -36
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +4 -4
- package/dist/openapi/index.d.ts +4 -4
- package/dist/openapi/index.js +88 -26
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6TDYSPLC.cjs +0 -44
- package/dist/chunk-6TDYSPLC.cjs.map +0 -1
- package/dist/chunk-ASOZUCE2.js.map +0 -1
- package/dist/chunk-HVKGDRTL.cjs.map +0 -1
- package/dist/chunk-OKKFL2M4.js +0 -44
- package/dist/chunk-OKKFL2M4.js.map +0 -1
- package/dist/chunk-UULT6NOS.cjs.map +0 -1
- package/dist/chunk-W6P57SNV.js.map +0 -1
package/dist/FastMCP.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkAAPHX5IGcjs = require('./chunk-AAPHX5IG.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -24,8 +24,8 @@ var _chunkUULT6NOScjs = require('./chunk-UULT6NOS.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
28
|
-
require('./chunk-
|
|
27
|
+
var _chunkVVAKRLCYcjs = require('./chunk-VVAKRLCY.cjs');
|
|
28
|
+
require('./chunk-2NZFMD6I.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -50,5 +50,5 @@ require('./chunk-6TDYSPLC.cjs');
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
exports.AuthProvider =
|
|
53
|
+
exports.AuthProvider = _chunkVVAKRLCYcjs.AuthProvider; exports.AzureProvider = _chunkVVAKRLCYcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkAAPHX5IGcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkAAPHX5IGcjs.FastMCP; exports.FastMCPError = _chunkAAPHX5IGcjs.FastMCPError; exports.FastMCPSession = _chunkAAPHX5IGcjs.FastMCPSession; exports.GitHubProvider = _chunkVVAKRLCYcjs.GitHubProvider; exports.GoogleProvider = _chunkVVAKRLCYcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkAAPHX5IGcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkVVAKRLCYcjs.OAuthProvider; exports.ServerState = _chunkAAPHX5IGcjs.ServerState; exports.SessionError = _chunkAAPHX5IGcjs.SessionError; exports.UnexpectedStateError = _chunkAAPHX5IGcjs.UnexpectedStateError; exports.UserError = _chunkAAPHX5IGcjs.UserError; exports.audioContent = _chunkAAPHX5IGcjs.audioContent; exports.getAuthSession = _chunkVVAKRLCYcjs.getAuthSession; exports.imageContent = _chunkAAPHX5IGcjs.imageContent; exports.jsonSchemaAdapter = _chunkAAPHX5IGcjs.jsonSchemaAdapter; exports.requireAll = _chunkVVAKRLCYcjs.requireAll; exports.requireAny = _chunkVVAKRLCYcjs.requireAny; exports.requireAuth = _chunkVVAKRLCYcjs.requireAuth; exports.requireRole = _chunkVVAKRLCYcjs.requireRole; exports.requireScopes = _chunkVVAKRLCYcjs.requireScopes;
|
|
54
54
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -12,8 +12,8 @@ import { CorsOptions } from 'mcp-proxy';
|
|
|
12
12
|
export { CorsOptions } from 'mcp-proxy';
|
|
13
13
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
16
|
-
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, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-
|
|
15
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BnQsqcsL.cjs';
|
|
16
|
+
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, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BnQsqcsL.cjs';
|
|
17
17
|
import 'node:http';
|
|
18
18
|
|
|
19
19
|
declare class DiscoveryDocumentCache {
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { CorsOptions } from 'mcp-proxy';
|
|
|
12
12
|
export { CorsOptions } from 'mcp-proxy';
|
|
13
13
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
16
|
-
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, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-
|
|
15
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BnQsqcsL.js';
|
|
16
|
+
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, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BnQsqcsL.js';
|
|
17
17
|
import 'node:http';
|
|
18
18
|
|
|
19
19
|
declare class DiscoveryDocumentCache {
|
package/dist/FastMCP.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
audioContent,
|
|
12
12
|
imageContent,
|
|
13
13
|
jsonSchemaAdapter
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EI3KPYSZ.js";
|
|
15
15
|
import {
|
|
16
16
|
AuthProvider,
|
|
17
17
|
AzureProvider,
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
requireAuth,
|
|
25
25
|
requireRole,
|
|
26
26
|
requireScopes
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-4ZSNKIR3.js";
|
|
28
|
+
import "./chunk-AM3HVK4Z.js";
|
|
29
29
|
export {
|
|
30
30
|
AuthProvider,
|
|
31
31
|
AzureProvider,
|
|
@@ -46,6 +46,8 @@ interface ClientCode {
|
|
|
46
46
|
createdAt: Date;
|
|
47
47
|
/** Code expiration timestamp */
|
|
48
48
|
expiresAt: Date;
|
|
49
|
+
/** Authorization redirect URI; absent on codes issued before it was recorded */
|
|
50
|
+
redirectUri?: string;
|
|
49
51
|
/** Associated transaction ID */
|
|
50
52
|
transactionId: string;
|
|
51
53
|
/** Upstream tokens obtained from provider */
|
|
@@ -190,7 +192,11 @@ interface OAuthProviderConfig {
|
|
|
190
192
|
* Configuration for the OAuth Proxy
|
|
191
193
|
*/
|
|
192
194
|
interface OAuthProxyConfig {
|
|
193
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* Fallback lifetime in seconds for swapped access tokens when upstream omits
|
|
197
|
+
* expires_in. Defaults to 3600 with an upstream refresh token, otherwise
|
|
198
|
+
* 31536000 (one year).
|
|
199
|
+
*/
|
|
194
200
|
accessTokenTtl?: number;
|
|
195
201
|
/**
|
|
196
202
|
* Allow-list of redirect URI patterns accepted by Dynamic Client Registration.
|
|
@@ -448,7 +454,7 @@ interface TokenRequest {
|
|
|
448
454
|
code: string;
|
|
449
455
|
code_verifier?: string;
|
|
450
456
|
grant_type: "authorization_code";
|
|
451
|
-
redirect_uri
|
|
457
|
+
redirect_uri?: string;
|
|
452
458
|
}
|
|
453
459
|
/**
|
|
454
460
|
* OAuth token response
|
|
@@ -512,7 +518,7 @@ interface TokenVerifier {
|
|
|
512
518
|
interface UpstreamTokenSet {
|
|
513
519
|
/** Access token */
|
|
514
520
|
accessToken: string;
|
|
515
|
-
/** Token expiration in seconds */
|
|
521
|
+
/** Token expiration in seconds; 0 when upstream expiry is unknown */
|
|
516
522
|
expiresIn: number;
|
|
517
523
|
/** ID token (for OIDC) */
|
|
518
524
|
idToken?: string;
|
|
@@ -607,6 +613,10 @@ declare class OAuthProxy {
|
|
|
607
613
|
tokenEndpointAuthSigningAlgValuesSupported?: string[];
|
|
608
614
|
uiLocalesSupported?: string[];
|
|
609
615
|
};
|
|
616
|
+
/**
|
|
617
|
+
* Get the configured OAuth callback path, including the default.
|
|
618
|
+
*/
|
|
619
|
+
getRedirectPath(): string;
|
|
610
620
|
/**
|
|
611
621
|
* Handle OAuth callback from upstream provider
|
|
612
622
|
*/
|
|
@@ -46,6 +46,8 @@ interface ClientCode {
|
|
|
46
46
|
createdAt: Date;
|
|
47
47
|
/** Code expiration timestamp */
|
|
48
48
|
expiresAt: Date;
|
|
49
|
+
/** Authorization redirect URI; absent on codes issued before it was recorded */
|
|
50
|
+
redirectUri?: string;
|
|
49
51
|
/** Associated transaction ID */
|
|
50
52
|
transactionId: string;
|
|
51
53
|
/** Upstream tokens obtained from provider */
|
|
@@ -190,7 +192,11 @@ interface OAuthProviderConfig {
|
|
|
190
192
|
* Configuration for the OAuth Proxy
|
|
191
193
|
*/
|
|
192
194
|
interface OAuthProxyConfig {
|
|
193
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* Fallback lifetime in seconds for swapped access tokens when upstream omits
|
|
197
|
+
* expires_in. Defaults to 3600 with an upstream refresh token, otherwise
|
|
198
|
+
* 31536000 (one year).
|
|
199
|
+
*/
|
|
194
200
|
accessTokenTtl?: number;
|
|
195
201
|
/**
|
|
196
202
|
* Allow-list of redirect URI patterns accepted by Dynamic Client Registration.
|
|
@@ -448,7 +454,7 @@ interface TokenRequest {
|
|
|
448
454
|
code: string;
|
|
449
455
|
code_verifier?: string;
|
|
450
456
|
grant_type: "authorization_code";
|
|
451
|
-
redirect_uri
|
|
457
|
+
redirect_uri?: string;
|
|
452
458
|
}
|
|
453
459
|
/**
|
|
454
460
|
* OAuth token response
|
|
@@ -512,7 +518,7 @@ interface TokenVerifier {
|
|
|
512
518
|
interface UpstreamTokenSet {
|
|
513
519
|
/** Access token */
|
|
514
520
|
accessToken: string;
|
|
515
|
-
/** Token expiration in seconds */
|
|
521
|
+
/** Token expiration in seconds; 0 when upstream expiry is unknown */
|
|
516
522
|
expiresIn: number;
|
|
517
523
|
/** ID token (for OIDC) */
|
|
518
524
|
idToken?: string;
|
|
@@ -607,6 +613,10 @@ declare class OAuthProxy {
|
|
|
607
613
|
tokenEndpointAuthSigningAlgValuesSupported?: string[];
|
|
608
614
|
uiLocalesSupported?: string[];
|
|
609
615
|
};
|
|
616
|
+
/**
|
|
617
|
+
* Get the configured OAuth callback path, including the default.
|
|
618
|
+
*/
|
|
619
|
+
getRedirectPath(): string;
|
|
610
620
|
/**
|
|
611
621
|
* Handle OAuth callback from upstream provider
|
|
612
622
|
*/
|
package/dist/auth/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkVVAKRLCYcjs = require('../chunk-VVAKRLCY.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -53,5 +53,5 @@ var _chunkHVKGDRTLcjs = require('../chunk-HVKGDRTL.cjs');
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
exports.AuthProvider =
|
|
56
|
+
exports.AuthProvider = _chunkVVAKRLCYcjs.AuthProvider; exports.AzureProvider = _chunkVVAKRLCYcjs.AzureProvider; exports.ConsentManager = _chunkVVAKRLCYcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkVVAKRLCYcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkVVAKRLCYcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkVVAKRLCYcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkVVAKRLCYcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkVVAKRLCYcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkVVAKRLCYcjs.DiskStore; exports.EncryptedTokenStorage = _chunkVVAKRLCYcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkVVAKRLCYcjs.GitHubProvider; exports.GoogleProvider = _chunkVVAKRLCYcjs.GoogleProvider; exports.JWKSVerifier = _chunkVVAKRLCYcjs.JWKSVerifier; exports.JWTIssuer = _chunkVVAKRLCYcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkVVAKRLCYcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkVVAKRLCYcjs.OAuthProvider; exports.OAuthProxy = _chunkVVAKRLCYcjs.OAuthProxy; exports.OAuthProxyError = _chunkVVAKRLCYcjs.OAuthProxyError; exports.PKCEUtils = _chunkVVAKRLCYcjs.PKCEUtils; exports.TOKEN_ENDPOINT_AUTH_METHODS = _chunkVVAKRLCYcjs.TOKEN_ENDPOINT_AUTH_METHODS; exports.getAuthSession = _chunkVVAKRLCYcjs.getAuthSession; exports.requireAll = _chunkVVAKRLCYcjs.requireAll; exports.requireAny = _chunkVVAKRLCYcjs.requireAny; exports.requireAuth = _chunkVVAKRLCYcjs.requireAuth; exports.requireRole = _chunkVVAKRLCYcjs.requireRole; exports.requireScopes = _chunkVVAKRLCYcjs.requireScopes;
|
|
57
57
|
//# sourceMappingURL=index.cjs.map
|
package/dist/auth/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s 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, E as DCRClientMetadata, F as DCRRequest, H as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, I as OAuthError, d as OAuthProvider, J as OAuthProviderConfig, a as OAuthProxy, K as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, L as ProxyDCRClient, R as RefreshRequest, y as TOKEN_ENDPOINT_AUTH_METHODS, M as TokenEndpointAuthMethod, N as TokenMapping, Q as TokenRequest, S as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BnQsqcsL.cjs';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, E as DCRClientMetadata, F as DCRRequest, H as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, I as OAuthError, d as OAuthProvider, J as OAuthProviderConfig, a as OAuthProxy, K as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, L as ProxyDCRClient, R as RefreshRequest, y as TOKEN_ENDPOINT_AUTH_METHODS, M as TokenEndpointAuthMethod, N as TokenMapping, Q as TokenRequest, S as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BnQsqcsL.cjs';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s 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, E as DCRClientMetadata, F as DCRRequest, H as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, I as OAuthError, d as OAuthProvider, J as OAuthProviderConfig, a as OAuthProxy, K as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, L as ProxyDCRClient, R as RefreshRequest, y as TOKEN_ENDPOINT_AUTH_METHODS, M as TokenEndpointAuthMethod, N as TokenMapping, Q as TokenRequest, S as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BnQsqcsL.js';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, E as DCRClientMetadata, F as DCRRequest, H as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, I as OAuthError, d as OAuthProvider, J as OAuthProviderConfig, a as OAuthProxy, K as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, L as ProxyDCRClient, R as RefreshRequest, y as TOKEN_ENDPOINT_AUTH_METHODS, M as TokenEndpointAuthMethod, N as TokenMapping, Q as TokenRequest, S as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BnQsqcsL.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/auth/index.js
CHANGED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/strictInputSchema.ts
|
|
2
|
+
var _zod = require('zod');
|
|
3
|
+
function objectRootSchema(schema) {
|
|
4
|
+
return schema.type === void 0 ? { ...schema, type: "object" } : schema;
|
|
5
|
+
}
|
|
6
|
+
function strictInputSchema(schema, nested = false) {
|
|
7
|
+
const { $ref, additionalProperties, allOf, anyOf, oneOf, properties } = schema;
|
|
8
|
+
if (!nested && ($ref || allOf || anyOf || oneOf)) {
|
|
9
|
+
return objectRootSchema(schema);
|
|
10
|
+
}
|
|
11
|
+
const keepsAdditionalProperties = Object.keys(_nullishCoalesce(properties, () => ( {}))).length === 0 && (typeof additionalProperties === "object" || additionalProperties === true || nested && additionalProperties === void 0 && !properties);
|
|
12
|
+
const strict = {
|
|
13
|
+
...schema,
|
|
14
|
+
...keepsAdditionalProperties ? {} : { additionalProperties: false },
|
|
15
|
+
...properties && {
|
|
16
|
+
properties: Object.fromEntries(
|
|
17
|
+
Object.entries(properties).map(([key, value]) => [
|
|
18
|
+
key,
|
|
19
|
+
typeof value === "object" && value.type === "object" ? strictInputSchema(value, true) : value
|
|
20
|
+
])
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return nested ? strict : objectRootSchema(strict);
|
|
25
|
+
}
|
|
26
|
+
function zodInputSchema(schema, target) {
|
|
27
|
+
const jsonSchema = _zod.z.toJSONSchema(schema, {
|
|
28
|
+
io: "input",
|
|
29
|
+
target
|
|
30
|
+
});
|
|
31
|
+
const definitionsKey = target === "draft-7" ? "definitions" : "$defs";
|
|
32
|
+
const definitions = {};
|
|
33
|
+
const operands = /* @__PURE__ */ new Map();
|
|
34
|
+
const closeObjects = (value, operand = false) => {
|
|
35
|
+
if (!value || typeof value !== "object") return value;
|
|
36
|
+
const result = { ...value };
|
|
37
|
+
if (operand && typeof result.$ref === "string" && (result.$ref === "#" || result.$ref.startsWith("#/"))) {
|
|
38
|
+
const reference = result.$ref;
|
|
39
|
+
let name = operands.get(reference);
|
|
40
|
+
if (!name) {
|
|
41
|
+
const path = decodeURIComponent(reference.slice(1)).split("/").slice(1);
|
|
42
|
+
const referenced = path.reduce(
|
|
43
|
+
(node, key) => node && typeof node === "object" ? node[key.replace(/~1/g, "/").replace(/~0/g, "~")] : void 0,
|
|
44
|
+
jsonSchema
|
|
45
|
+
);
|
|
46
|
+
if (referenced && typeof referenced === "object") {
|
|
47
|
+
name = `__fastmcp_operand_${operands.size}`;
|
|
48
|
+
const existing = jsonSchema[definitionsKey];
|
|
49
|
+
while (Object.hasOwn(_nullishCoalesce(existing, () => ( {})), name) || Object.hasOwn(definitions, name))
|
|
50
|
+
name += "_";
|
|
51
|
+
operands.set(reference, name);
|
|
52
|
+
const copy = { ...referenced };
|
|
53
|
+
delete copy.$schema;
|
|
54
|
+
delete copy.$defs;
|
|
55
|
+
delete copy.definitions;
|
|
56
|
+
definitions[name] = closeObjects(copy, true);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (name) result.$ref = `#/${definitionsKey}/${name}`;
|
|
60
|
+
}
|
|
61
|
+
if (!operand && result.type === "object" && result.properties !== void 0 && result.additionalProperties === void 0) {
|
|
62
|
+
result.additionalProperties = false;
|
|
63
|
+
}
|
|
64
|
+
for (const keyword of ["allOf", "anyOf", "oneOf"]) {
|
|
65
|
+
const branches = result[keyword];
|
|
66
|
+
if (Array.isArray(branches)) {
|
|
67
|
+
result[keyword] = branches.map(
|
|
68
|
+
(branch) => closeObjects(
|
|
69
|
+
branch,
|
|
70
|
+
operand || keyword === "allOf" && branches.length > 1
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const keyword of [
|
|
76
|
+
"$defs",
|
|
77
|
+
"definitions",
|
|
78
|
+
"patternProperties",
|
|
79
|
+
"properties"
|
|
80
|
+
]) {
|
|
81
|
+
const children = result[keyword];
|
|
82
|
+
if (children && typeof children === "object") {
|
|
83
|
+
result[keyword] = Object.fromEntries(
|
|
84
|
+
Object.entries(children).map(([key, child]) => [
|
|
85
|
+
key,
|
|
86
|
+
closeObjects(child)
|
|
87
|
+
])
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const keyword of [
|
|
92
|
+
"additionalItems",
|
|
93
|
+
"additionalProperties",
|
|
94
|
+
"items",
|
|
95
|
+
"prefixItems",
|
|
96
|
+
"propertyNames"
|
|
97
|
+
]) {
|
|
98
|
+
const child = result[keyword];
|
|
99
|
+
if (child !== void 0) {
|
|
100
|
+
result[keyword] = Array.isArray(child) ? child.map((item) => closeObjects(item)) : closeObjects(child);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
105
|
+
const closed = closeObjects(jsonSchema);
|
|
106
|
+
if (operands.size > 0) {
|
|
107
|
+
closed[definitionsKey] = {
|
|
108
|
+
...closed[definitionsKey],
|
|
109
|
+
...definitions
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return closed;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
exports.objectRootSchema = objectRootSchema; exports.strictInputSchema = strictInputSchema; exports.zodInputSchema = zodInputSchema;
|
|
120
|
+
//# sourceMappingURL=chunk-2NZFMD6I.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fastmcp/fastmcp/dist/chunk-2NZFMD6I.cjs","../src/strictInputSchema.ts"],"names":[],"mappings":"AAAA;ACEA,0BAAkB;AAUX,SAAS,gBAAA,CAAiB,MAAA,EAAgC;AAC/D,EAAA,OAAO,MAAA,CAAO,KAAA,IAAS,KAAA,EAAA,EAAY,EAAE,GAAG,MAAA,EAAQ,IAAA,EAAM,SAAS,EAAA,EAAI,MAAA;AACrE;AA2BO,SAAS,iBAAA,CACd,MAAA,EACA,OAAA,EAAS,KAAA,EACG;AACZ,EAAA,MAAM,EAAE,IAAA,EAAM,oBAAA,EAAsB,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,WAAW,EAAA,EAClE,MAAA;AAEF,EAAA,GAAA,CAAI,CAAC,OAAA,GAAA,CAAW,KAAA,GAAQ,MAAA,GAAS,MAAA,GAAS,KAAA,CAAA,EAAQ;AAChD,IAAA,OAAO,gBAAA,CAAiB,MAAM,CAAA;AAAA,EAChC;AAEA,EAAA,MAAM,0BAAA,EACJ,MAAA,CAAO,IAAA,kBAAK,UAAA,UAAc,CAAC,GAAC,CAAA,CAAE,OAAA,IAAW,EAAA,GAAA,CACxC,OAAO,qBAAA,IAAyB,SAAA,GAC/B,qBAAA,IAAyB,KAAA,GACxB,OAAA,GAAU,qBAAA,IAAyB,KAAA,EAAA,GAAa,CAAC,UAAA,CAAA;AAEtD,EAAA,MAAM,OAAA,EAAS;AAAA,IACb,GAAG,MAAA;AAAA,IACH,GAAI,0BAAA,EAA4B,CAAC,EAAA,EAAI,EAAE,oBAAA,EAAsB,MAAM,CAAA;AAAA,IACnE,GAAI,WAAA,GAAc;AAAA,MAChB,UAAA,EAAY,MAAA,CAAO,WAAA;AAAA,QACjB,MAAA,CAAO,OAAA,CAAQ,UAAU,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,EAAA,GAAM;AAAA,UAC/C,GAAA;AAAA,UACA,OAAO,MAAA,IAAU,SAAA,GAAY,KAAA,CAAM,KAAA,IAAS,SAAA,EACxC,iBAAA,CAAkB,KAAA,EAAO,IAAI,EAAA,EAC7B;AAAA,QACN,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAA;AAEA,EAAA,OAAO,OAAA,EAAS,OAAA,EAAS,gBAAA,CAAiB,MAAM,CAAA;AAClD;AASO,SAAS,cAAA,CACd,MAAA,EACA,MAAA,EACY;AACZ,EAAA,MAAM,WAAA,EAAa,MAAA,CAAE,YAAA,CAAa,MAAA,EAAQ;AAAA,IACxC,EAAA,EAAI,OAAA;AAAA,IACJ;AAAA,EACF,CAAC,CAAA;AACD,EAAA,MAAM,eAAA,EAAiB,OAAA,IAAW,UAAA,EAAY,cAAA,EAAgB,OAAA;AAC9D,EAAA,MAAM,YAAA,EAAuC,CAAC,CAAA;AAC9C,EAAA,MAAM,SAAA,kBAAW,IAAI,GAAA,CAAoB,CAAA;AAEzC,EAAA,MAAM,aAAA,EAAe,CAAC,KAAA,EAAgB,QAAA,EAAU,KAAA,EAAA,GAAmB;AACjE,IAAA,GAAA,CAAI,CAAC,MAAA,GAAS,OAAO,MAAA,IAAU,QAAA,EAAU,OAAO,KAAA;AAChD,IAAA,MAAM,OAAA,EAAS,EAAE,GAAI,MAAkC,CAAA;AAEvD,IAAA,GAAA,CACE,QAAA,GACA,OAAO,MAAA,CAAO,KAAA,IAAS,SAAA,GAAA,CACtB,MAAA,CAAO,KAAA,IAAS,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,UAAA,CAAW,IAAI,CAAA,CAAA,EACnD;AACA,MAAA,MAAM,UAAA,EAAY,MAAA,CAAO,IAAA;AACzB,MAAA,IAAI,KAAA,EAAO,QAAA,CAAS,GAAA,CAAI,SAAS,CAAA;AACjC,MAAA,GAAA,CAAI,CAAC,IAAA,EAAM;AACT,QAAA,MAAM,KAAA,EAAO,kBAAA,CAAmB,SAAA,CAAU,KAAA,CAAM,CAAC,CAAC,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA;AACtE,QAAA,MAAM,WAAA,EAAa,IAAA,CAAK,MAAA;AAAA,UACtB,CAAC,IAAA,EAAM,GAAA,EAAA,GACL,KAAA,GAAQ,OAAO,KAAA,IAAS,SAAA,EACnB,IAAA,CACC,GAAA,CAAI,OAAA,CAAQ,KAAA,EAAO,GAAG,CAAA,CAAE,OAAA,CAAQ,KAAA,EAAO,GAAG,CAC5C,EAAA,EACA,KAAA,CAAA;AAAA,UACN;AAAA,QACF,CAAA;AACA,QAAA,GAAA,CAAI,WAAA,GAAc,OAAO,WAAA,IAAe,QAAA,EAAU;AAChD,UAAA,KAAA,EAAO,CAAA,kBAAA,EAAqB,QAAA,CAAS,IAAI,CAAA,CAAA;AACC,UAAA;AAEN,UAAA;AAG1B,YAAA;AAEkB,UAAA;AAC8B,UAAA;AAC9C,UAAA;AACA,UAAA;AACA,UAAA;AAC2B,UAAA;AACzC,QAAA;AACF,MAAA;AAC2C,MAAA;AAC7C,IAAA;AAKE,IAAA;AAG8B,MAAA;AAChC,IAAA;AAEgD,IAAA;AACf,MAAA;AACF,MAAA;AAGA,QAAA;AACzB,UAAA;AACE,YAAA;AACmC,YAAA;AACrC,UAAA;AACF,QAAA;AACF,MAAA;AACF,IAAA;AAEsB,IAAA;AACpB,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACC,IAAA;AAC8B,MAAA;AACe,MAAA;AACnB,QAAA;AACkB,UAAA;AACvC,YAAA;AACkB,YAAA;AACnB,UAAA;AACH,QAAA;AACF,MAAA;AACF,IAAA;AACsB,IAAA;AACpB,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACC,IAAA;AAC2B,MAAA;AACH,MAAA;AAEnB,QAAA;AAEN,MAAA;AACF,IAAA;AACO,IAAA;AACT,EAAA;AAEsC,EAAA;AACf,EAAA;AACI,IAAA;AACE,MAAA;AACtB,MAAA;AACL,IAAA;AACF,EAAA;AACO,EAAA;AACT;ADxFoD;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/fastmcp/fastmcp/dist/chunk-2NZFMD6I.cjs","sourcesContent":[null,"import type { JsonSchema } from \"xsschema\";\n\nimport { z } from \"zod\";\n\n/**\n * Gives a tool's input or output schema the `type: \"object\"` MCP requires at\n * its root, unless it states a type of its own. A union of objects converts to\n * a bare `anyOf` or `oneOf`, and the SDK client rejects a whole `tools/list`\n * that contains one, so a single such tool would hide every other. Arguments\n * and structured content are always objects, so this only rules out values a\n * tool can never be sent or return.\n */\nexport function objectRootSchema(schema: JsonSchema): JsonSchema {\n return schema.type === undefined ? { ...schema, type: \"object\" } : schema;\n}\n\n/**\n * Closes tool input objects to undeclared keys, like xsschema's\n * `strictJsonSchema`, except for objects made only of additional properties.\n * Closing one of those advertises an object that accepts nothing but `{}`,\n * while the tool's own validation still takes any key, so it keeps whatever\n * `additionalProperties` it declared — or none:\n *\n * - a dictionary, whose `additionalProperties` is a schema (`z.record()`, an\n * OpenAPI map), keeps its value schema;\n * - a free-form object, which declares `additionalProperties: true`, or, as an\n * argument, is a bare `{ type: \"object\" }` (OpenAPI's usual spelling), stays\n * open.\n *\n * A plain object that declares an empty `properties`, or a bare one at the\n * top of the input, is still closed: that is how a schema says \"no keys\" —\n * `z.object({})`, or a tool without arguments. Root schemas with `allOf`,\n * `anyOf`, `oneOf`, or `$ref` are left as declared, even with their own\n * `properties`: `additionalProperties` only sees adjacent properties, so\n * adding it would reject keys declared by a branch or reference target.\n *\n * The root is given an object type (see `objectRootSchema`).\n *\n * Shared by both runtimes, so a tool's advertised input schema does not depend\n * on whether it is served by `FastMCP` or `EdgeFastMCP`.\n */\nexport function strictInputSchema(\n schema: JsonSchema,\n nested = false,\n): JsonSchema {\n const { $ref, additionalProperties, allOf, anyOf, oneOf, properties } =\n schema;\n\n if (!nested && ($ref || allOf || anyOf || oneOf)) {\n return objectRootSchema(schema);\n }\n\n const keepsAdditionalProperties =\n Object.keys(properties ?? {}).length === 0 &&\n (typeof additionalProperties === \"object\" ||\n additionalProperties === true ||\n (nested && additionalProperties === undefined && !properties));\n\n const strict = {\n ...schema,\n ...(keepsAdditionalProperties ? {} : { additionalProperties: false }),\n ...(properties && {\n properties: Object.fromEntries(\n Object.entries(properties).map(([key, value]) => [\n key,\n typeof value === \"object\" && value.type === \"object\"\n ? strictInputSchema(value, true)\n : value,\n ]),\n ),\n }),\n };\n\n return nested ? strict : objectRootSchema(strict);\n}\n\n/**\n * Converts Zod 4 tool parameters by what a call may send (`io: \"input\"`), so a\n * transformed field advertises the type it parses and a defaulted one is\n * optional. Close ordinary object occurrences after conversion, but leave\n * intersection operands open to each other's keys. Child values start a new\n * closure context; explicit catchalls, including .strict(), stay as declared.\n */\nexport function zodInputSchema(\n schema: z.ZodType,\n target?: \"draft-7\",\n): JsonSchema {\n const jsonSchema = z.toJSONSchema(schema, {\n io: \"input\",\n target,\n }) as Record<string, unknown>;\n const definitionsKey = target === \"draft-7\" ? \"definitions\" : \"$defs\";\n const definitions: Record<string, unknown> = {};\n const operands = new Map<string, string>();\n\n const closeObjects = (value: unknown, operand = false): unknown => {\n if (!value || typeof value !== \"object\") return value;\n const result = { ...(value as Record<string, unknown>) };\n\n if (\n operand &&\n typeof result.$ref === \"string\" &&\n (result.$ref === \"#\" || result.$ref.startsWith(\"#/\"))\n ) {\n const reference = result.$ref;\n let name = operands.get(reference);\n if (!name) {\n const path = decodeURIComponent(reference.slice(1)).split(\"/\").slice(1);\n const referenced = path.reduce<unknown>(\n (node, key) =>\n node && typeof node === \"object\"\n ? (node as Record<string, unknown>)[\n key.replace(/~1/g, \"/\").replace(/~0/g, \"~\")\n ]\n : undefined,\n jsonSchema,\n );\n if (referenced && typeof referenced === \"object\") {\n name = `__fastmcp_operand_${operands.size}`;\n const existing = jsonSchema[definitionsKey] as object | undefined;\n while (\n Object.hasOwn(existing ?? {}, name) ||\n Object.hasOwn(definitions, name)\n )\n name += \"_\";\n // Reserve the reference before descending, including through child values.\n operands.set(reference, name);\n const copy = { ...(referenced as Record<string, unknown>) };\n delete copy.$schema;\n delete copy.$defs;\n delete copy.definitions;\n definitions[name] = closeObjects(copy, true);\n }\n }\n if (name) result.$ref = `#/${definitionsKey}/${name}`;\n }\n\n if (\n !operand &&\n result.type === \"object\" &&\n result.properties !== undefined &&\n result.additionalProperties === undefined\n ) {\n result.additionalProperties = false;\n }\n\n for (const keyword of [\"allOf\", \"anyOf\", \"oneOf\"]) {\n const branches = result[keyword];\n if (Array.isArray(branches)) {\n // A single allOf branch is Zod's draft-7 reference wrapper, not\n // an intersection. Only intersections introduce a new exemption.\n result[keyword] = branches.map((branch) =>\n closeObjects(\n branch,\n operand || (keyword === \"allOf\" && branches.length > 1),\n ),\n );\n }\n }\n\n for (const keyword of [\n \"$defs\",\n \"definitions\",\n \"patternProperties\",\n \"properties\",\n ]) {\n const children = result[keyword];\n if (children && typeof children === \"object\") {\n result[keyword] = Object.fromEntries(\n Object.entries(children).map(([key, child]) => [\n key,\n closeObjects(child),\n ]),\n );\n }\n }\n for (const keyword of [\n \"additionalItems\",\n \"additionalProperties\",\n \"items\",\n \"prefixItems\",\n \"propertyNames\",\n ]) {\n const child = result[keyword];\n if (child !== undefined) {\n result[keyword] = Array.isArray(child)\n ? child.map((item) => closeObjects(item))\n : closeObjects(child);\n }\n }\n return result;\n };\n\n const closed = closeObjects(jsonSchema) as Record<string, unknown>;\n if (operands.size > 0) {\n closed[definitionsKey] = {\n ...(closed[definitionsKey] as Record<string, unknown>),\n ...definitions,\n };\n }\n return closed as JsonSchema;\n}\n"]}
|
|
@@ -120,6 +120,7 @@ var clientCodeStorageSchema = z.object({
|
|
|
120
120
|
codeChallengeMethod: z.string(),
|
|
121
121
|
createdAt: storedDateSchema,
|
|
122
122
|
expiresAt: storedDateSchema,
|
|
123
|
+
redirectUri: z.string().optional(),
|
|
123
124
|
transactionId: z.string(),
|
|
124
125
|
upstreamTokens: upstreamTokenSetStorageSchema,
|
|
125
126
|
used: z.boolean().optional()
|
|
@@ -1610,6 +1611,21 @@ var OAuthProxy = class {
|
|
|
1610
1611
|
"Authorization code was issued to another client"
|
|
1611
1612
|
);
|
|
1612
1613
|
}
|
|
1614
|
+
if (clientCode.redirectUri !== void 0) {
|
|
1615
|
+
if (request.redirect_uri) {
|
|
1616
|
+
if (request.redirect_uri !== clientCode.redirectUri) {
|
|
1617
|
+
throw new OAuthProxyError(
|
|
1618
|
+
"invalid_grant",
|
|
1619
|
+
"redirect_uri does not match the authorization request"
|
|
1620
|
+
);
|
|
1621
|
+
}
|
|
1622
|
+
} else if (!clientCode.codeChallenge) {
|
|
1623
|
+
throw new OAuthProxyError(
|
|
1624
|
+
"invalid_request",
|
|
1625
|
+
"redirect_uri is required for a code issued without PKCE"
|
|
1626
|
+
);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1613
1629
|
if (!authenticated && (!clientCode.codeChallenge || clientCode.codeChallengeMethod !== "S256")) {
|
|
1614
1630
|
throw new OAuthProxyError(
|
|
1615
1631
|
"invalid_grant",
|
|
@@ -1637,6 +1653,11 @@ var OAuthProxy = class {
|
|
|
1637
1653
|
if (!valid) {
|
|
1638
1654
|
throw new OAuthProxyError("invalid_grant", "Invalid PKCE verifier");
|
|
1639
1655
|
}
|
|
1656
|
+
} else if (request.code_verifier) {
|
|
1657
|
+
throw new OAuthProxyError(
|
|
1658
|
+
"invalid_request",
|
|
1659
|
+
"code_verifier provided without a code_challenge"
|
|
1660
|
+
);
|
|
1640
1661
|
}
|
|
1641
1662
|
if (this.config.enableTokenSwap && this.jwtIssuer) {
|
|
1642
1663
|
return await this.issueSwappedTokens(
|
|
@@ -1647,7 +1668,7 @@ var OAuthProxy = class {
|
|
|
1647
1668
|
} else {
|
|
1648
1669
|
const response = {
|
|
1649
1670
|
access_token: clientCode.upstreamTokens.accessToken,
|
|
1650
|
-
expires_in: clientCode.upstreamTokens.expiresIn,
|
|
1671
|
+
expires_in: clientCode.upstreamTokens.expiresIn || 3600,
|
|
1651
1672
|
token_type: clientCode.upstreamTokens.tokenType
|
|
1652
1673
|
};
|
|
1653
1674
|
if (clientCode.upstreamTokens.refreshToken) {
|
|
@@ -1707,6 +1728,12 @@ var OAuthProxy = class {
|
|
|
1707
1728
|
]
|
|
1708
1729
|
};
|
|
1709
1730
|
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Get the configured OAuth callback path, including the default.
|
|
1733
|
+
*/
|
|
1734
|
+
getRedirectPath() {
|
|
1735
|
+
return this.config.redirectPath;
|
|
1736
|
+
}
|
|
1710
1737
|
/**
|
|
1711
1738
|
* Handle OAuth callback from upstream provider
|
|
1712
1739
|
*/
|
|
@@ -2105,7 +2132,7 @@ var OAuthProxy = class {
|
|
|
2105
2132
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2106
2133
|
return {
|
|
2107
2134
|
accessToken: tokens.access_token,
|
|
2108
|
-
expiresIn: tokens.expires_in
|
|
2135
|
+
expiresIn: tokens.expires_in ?? 0,
|
|
2109
2136
|
idToken: tokens.id_token,
|
|
2110
2137
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2111
2138
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -2197,6 +2224,7 @@ var OAuthProxy = class {
|
|
|
2197
2224
|
expiresAt: new Date(
|
|
2198
2225
|
Date.now() + (this.config.authorizationCodeTtl || 300) * 1e3
|
|
2199
2226
|
),
|
|
2227
|
+
redirectUri: transaction.clientCallbackUrl,
|
|
2200
2228
|
transactionId: transaction.id,
|
|
2201
2229
|
upstreamTokens
|
|
2202
2230
|
};
|
|
@@ -2631,7 +2659,11 @@ var OAuthProxy = class {
|
|
|
2631
2659
|
id_token: z2.string().optional(),
|
|
2632
2660
|
refresh_expires_in: z2.coerce.number().int().positive().optional(),
|
|
2633
2661
|
refresh_token: z2.string().optional(),
|
|
2634
|
-
|
|
2662
|
+
// GitHub separates scopes with commas; RFC 6749 allows commas inside
|
|
2663
|
+
// a scope token, so other providers must keep them unchanged.
|
|
2664
|
+
scope: z2.string().transform(
|
|
2665
|
+
(scope) => this.config.upstreamTokenEndpoint === "https://github.com/login/oauth/access_token" ? scope.split(/[ ,]+/).filter(Boolean).join(" ") : scope
|
|
2666
|
+
).optional(),
|
|
2635
2667
|
token_type: z2.string().optional()
|
|
2636
2668
|
});
|
|
2637
2669
|
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
@@ -2738,7 +2770,7 @@ var OAuthProxy = class {
|
|
|
2738
2770
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2739
2771
|
return {
|
|
2740
2772
|
accessToken: tokens.access_token,
|
|
2741
|
-
expiresIn: tokens.expires_in
|
|
2773
|
+
expiresIn: tokens.expires_in ?? 0,
|
|
2742
2774
|
idToken: tokens.id_token,
|
|
2743
2775
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2744
2776
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -3579,4 +3611,4 @@ export {
|
|
|
3579
3611
|
DiskStore,
|
|
3580
3612
|
JWKSVerifier
|
|
3581
3613
|
};
|
|
3582
|
-
//# sourceMappingURL=chunk-
|
|
3614
|
+
//# sourceMappingURL=chunk-4ZSNKIR3.js.map
|