fastmcp 4.1.0 → 4.3.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/README.md +40 -0
- package/dist/FastMCP.cjs +3 -3
- package/dist/FastMCP.d.cts +5 -2
- package/dist/FastMCP.d.ts +5 -2
- package/dist/FastMCP.js +2 -2
- package/dist/{OAuthProvider-BS7O-cik.d.cts → OAuthProvider-vyjR-9Z7.d.cts} +12 -0
- package/dist/{OAuthProvider-BS7O-cik.d.ts → OAuthProvider-vyjR-9Z7.d.ts} +12 -0
- 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-OARN6YYK.cjs → chunk-JFLKZGBG.cjs} +19 -1
- package/dist/chunk-JFLKZGBG.cjs.map +1 -0
- package/dist/{chunk-HGUUOYR4.js → chunk-KHM5DJG7.js} +19 -1
- package/dist/chunk-KHM5DJG7.js.map +1 -0
- package/dist/{chunk-L6L4HDOR.cjs → chunk-PD73R4M6.cjs} +20 -10
- package/dist/chunk-PD73R4M6.cjs.map +1 -0
- package/dist/{chunk-S4BQGYO7.js → chunk-QWUBNXAF.js} +16 -6
- package/dist/chunk-QWUBNXAF.js.map +1 -0
- package/dist/examples/custom-routes.cjs +3 -3
- package/dist/examples/custom-routes.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-HGUUOYR4.js.map +0 -1
- package/dist/chunk-L6L4HDOR.cjs.map +0 -1
- package/dist/chunk-OARN6YYK.cjs.map +0 -1
- package/dist/chunk-S4BQGYO7.js.map +0 -1
package/README.md
CHANGED
|
@@ -219,6 +219,46 @@ openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -node
|
|
|
219
219
|
|
|
220
220
|
See the [https-server example](src/examples/https-server.ts) for a complete demonstration.
|
|
221
221
|
|
|
222
|
+
##### CORS Configuration
|
|
223
|
+
|
|
224
|
+
By default, FastMCP enables CORS with a standard set of allowed headers. You can customize the CORS behavior by passing a `cors` option:
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
server.start({
|
|
228
|
+
transportType: "httpStream",
|
|
229
|
+
httpStream: {
|
|
230
|
+
port: 8080,
|
|
231
|
+
cors: {
|
|
232
|
+
origin: "http://localhost:3000",
|
|
233
|
+
allowedHeaders: [
|
|
234
|
+
"Content-Type",
|
|
235
|
+
"Authorization",
|
|
236
|
+
"Accept",
|
|
237
|
+
"Mcp-Session-Id",
|
|
238
|
+
"Mcp-Protocol-Version",
|
|
239
|
+
"Last-Event-Id",
|
|
240
|
+
"X-Custom-Header",
|
|
241
|
+
],
|
|
242
|
+
credentials: true,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The `cors` option accepts:
|
|
249
|
+
|
|
250
|
+
- `true` (default) - enable CORS with default settings
|
|
251
|
+
- `false` - disable CORS entirely
|
|
252
|
+
- An object with these fields:
|
|
253
|
+
- `origin` - a string, array of strings, or a function `(origin: string) => boolean`
|
|
254
|
+
- `allowedHeaders` - a string or array of strings
|
|
255
|
+
- `methods` - array of allowed HTTP methods
|
|
256
|
+
- `exposedHeaders` - array of headers to expose
|
|
257
|
+
- `credentials` - boolean to allow credentials
|
|
258
|
+
- `maxAge` - preflight cache duration in seconds
|
|
259
|
+
|
|
260
|
+
The `CorsOptions` type is exported from `fastmcp` for convenience.
|
|
261
|
+
|
|
222
262
|
#### Custom HTTP Routes
|
|
223
263
|
|
|
224
264
|
FastMCP allows you to add custom HTTP routes alongside MCP endpoints, enabling you to build comprehensive HTTP services that include REST APIs, webhooks, admin interfaces, and more - all within the same server process.
|
package/dist/FastMCP.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkPD73R4M6cjs = require('./chunk-PD73R4M6.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ var _chunkL6L4HDORcjs = require('./chunk-L6L4HDOR.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkJFLKZGBGcjs = require('./chunk-JFLKZGBG.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -41,5 +41,5 @@ var _chunkOARN6YYKcjs = require('./chunk-OARN6YYK.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
exports.AuthProvider =
|
|
44
|
+
exports.AuthProvider = _chunkJFLKZGBGcjs.AuthProvider; exports.AzureProvider = _chunkJFLKZGBGcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkPD73R4M6cjs.DiscoveryDocumentCache; exports.FastMCP = _chunkPD73R4M6cjs.FastMCP; exports.FastMCPSession = _chunkPD73R4M6cjs.FastMCPSession; exports.GitHubProvider = _chunkJFLKZGBGcjs.GitHubProvider; exports.GoogleProvider = _chunkJFLKZGBGcjs.GoogleProvider; exports.OAuthProvider = _chunkJFLKZGBGcjs.OAuthProvider; exports.ServerState = _chunkPD73R4M6cjs.ServerState; exports.UnexpectedStateError = _chunkPD73R4M6cjs.UnexpectedStateError; exports.UserError = _chunkPD73R4M6cjs.UserError; exports.audioContent = _chunkPD73R4M6cjs.audioContent; exports.getAuthSession = _chunkJFLKZGBGcjs.getAuthSession; exports.imageContent = _chunkPD73R4M6cjs.imageContent; exports.requireAll = _chunkJFLKZGBGcjs.requireAll; exports.requireAny = _chunkJFLKZGBGcjs.requireAny; exports.requireAuth = _chunkJFLKZGBGcjs.requireAuth; exports.requireRole = _chunkJFLKZGBGcjs.requireRole; exports.requireScopes = _chunkJFLKZGBGcjs.requireScopes;
|
|
45
45
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -8,10 +8,12 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
|
8
8
|
import { EventEmitter } from 'events';
|
|
9
9
|
import { Hono } from 'hono';
|
|
10
10
|
import http from 'http';
|
|
11
|
+
import { CorsOptions } from 'mcp-proxy';
|
|
12
|
+
export { CorsOptions } from 'mcp-proxy';
|
|
11
13
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
12
14
|
import { z } from 'zod';
|
|
13
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
14
|
-
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-vyjR-9Z7.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-vyjR-9Z7.cjs';
|
|
15
17
|
import 'node:http';
|
|
16
18
|
|
|
17
19
|
declare class DiscoveryDocumentCache {
|
|
@@ -859,6 +861,7 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
|
|
|
859
861
|
*/
|
|
860
862
|
start(options?: Partial<{
|
|
861
863
|
httpStream: {
|
|
864
|
+
cors?: boolean | CorsOptions;
|
|
862
865
|
enableJsonResponse?: boolean;
|
|
863
866
|
endpoint?: `/${string}`;
|
|
864
867
|
eventStore?: EventStore;
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -8,10 +8,12 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
|
8
8
|
import { EventEmitter } from 'events';
|
|
9
9
|
import { Hono } from 'hono';
|
|
10
10
|
import http from 'http';
|
|
11
|
+
import { CorsOptions } from 'mcp-proxy';
|
|
12
|
+
export { CorsOptions } from 'mcp-proxy';
|
|
11
13
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
12
14
|
import { z } from 'zod';
|
|
13
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
14
|
-
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-vyjR-9Z7.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-vyjR-9Z7.js';
|
|
15
17
|
import 'node:http';
|
|
16
18
|
|
|
17
19
|
declare class DiscoveryDocumentCache {
|
|
@@ -859,6 +861,7 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
|
|
|
859
861
|
*/
|
|
860
862
|
start(options?: Partial<{
|
|
861
863
|
httpStream: {
|
|
864
|
+
cors?: boolean | CorsOptions;
|
|
862
865
|
enableJsonResponse?: boolean;
|
|
863
866
|
endpoint?: `/${string}`;
|
|
864
867
|
eventStore?: EventStore;
|
package/dist/FastMCP.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
UserError,
|
|
8
8
|
audioContent,
|
|
9
9
|
imageContent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QWUBNXAF.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthProvider,
|
|
13
13
|
AzureProvider,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
requireAuth,
|
|
21
21
|
requireRole,
|
|
22
22
|
requireScopes
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-KHM5DJG7.js";
|
|
24
24
|
export {
|
|
25
25
|
AuthProvider,
|
|
26
26
|
AzureProvider,
|
|
@@ -226,6 +226,18 @@ interface OAuthProxyConfig {
|
|
|
226
226
|
enableTokenSwap?: boolean;
|
|
227
227
|
/** Encryption key for token storage (default: auto-generated). Set to false to disable encryption. */
|
|
228
228
|
encryptionKey?: false | string;
|
|
229
|
+
/**
|
|
230
|
+
* Extra query parameters appended to the upstream authorization URL.
|
|
231
|
+
* Required by providers such as Google, which only issues a refresh_token
|
|
232
|
+
* when the authorization request carries `access_type=offline` (and
|
|
233
|
+
* re-issues it on re-auth with `prompt=consent`). Without these, access
|
|
234
|
+
* expires after the upstream token TTL and can never be renewed.
|
|
235
|
+
*
|
|
236
|
+
* Core OAuth parameters managed by the proxy (client_id, redirect_uri,
|
|
237
|
+
* response_type, state, scope, code_challenge, code_challenge_method)
|
|
238
|
+
* cannot be overridden — entries with those keys are ignored.
|
|
239
|
+
*/
|
|
240
|
+
extraAuthorizationParams?: Record<string, string>;
|
|
229
241
|
/** Forward client's PKCE to upstream (default: false) */
|
|
230
242
|
forwardPkce?: boolean;
|
|
231
243
|
/** Secret key for signing JWTs when token swap is enabled */
|
|
@@ -226,6 +226,18 @@ interface OAuthProxyConfig {
|
|
|
226
226
|
enableTokenSwap?: boolean;
|
|
227
227
|
/** Encryption key for token storage (default: auto-generated). Set to false to disable encryption. */
|
|
228
228
|
encryptionKey?: false | string;
|
|
229
|
+
/**
|
|
230
|
+
* Extra query parameters appended to the upstream authorization URL.
|
|
231
|
+
* Required by providers such as Google, which only issues a refresh_token
|
|
232
|
+
* when the authorization request carries `access_type=offline` (and
|
|
233
|
+
* re-issues it on re-auth with `prompt=consent`). Without these, access
|
|
234
|
+
* expires after the upstream token TTL and can never be renewed.
|
|
235
|
+
*
|
|
236
|
+
* Core OAuth parameters managed by the proxy (client_id, redirect_uri,
|
|
237
|
+
* response_type, state, scope, code_challenge, code_challenge_method)
|
|
238
|
+
* cannot be overridden — entries with those keys are ignored.
|
|
239
|
+
*/
|
|
240
|
+
extraAuthorizationParams?: Record<string, string>;
|
|
229
241
|
/** Forward client's PKCE to upstream (default: false) */
|
|
230
242
|
forwardPkce?: boolean;
|
|
231
243
|
/** Secret key for signing JWTs when token swap is enabled */
|
package/dist/auth/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkJFLKZGBGcjs = require('../chunk-JFLKZGBG.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -51,5 +51,5 @@ var _chunkOARN6YYKcjs = require('../chunk-OARN6YYK.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
exports.AuthProvider =
|
|
54
|
+
exports.AuthProvider = _chunkJFLKZGBGcjs.AuthProvider; exports.AzureProvider = _chunkJFLKZGBGcjs.AzureProvider; exports.ConsentManager = _chunkJFLKZGBGcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkJFLKZGBGcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkJFLKZGBGcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkJFLKZGBGcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkJFLKZGBGcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkJFLKZGBGcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkJFLKZGBGcjs.DiskStore; exports.EncryptedTokenStorage = _chunkJFLKZGBGcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkJFLKZGBGcjs.GitHubProvider; exports.GoogleProvider = _chunkJFLKZGBGcjs.GoogleProvider; exports.JWKSVerifier = _chunkJFLKZGBGcjs.JWKSVerifier; exports.JWTIssuer = _chunkJFLKZGBGcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkJFLKZGBGcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkJFLKZGBGcjs.OAuthProvider; exports.OAuthProxy = _chunkJFLKZGBGcjs.OAuthProxy; exports.OAuthProxyError = _chunkJFLKZGBGcjs.OAuthProxyError; exports.PKCEUtils = _chunkJFLKZGBGcjs.PKCEUtils; exports.getAuthSession = _chunkJFLKZGBGcjs.getAuthSession; exports.requireAll = _chunkJFLKZGBGcjs.requireAll; exports.requireAny = _chunkJFLKZGBGcjs.requireAny; exports.requireAuth = _chunkJFLKZGBGcjs.requireAuth; exports.requireRole = _chunkJFLKZGBGcjs.requireRole; exports.requireScopes = _chunkJFLKZGBGcjs.requireScopes;
|
|
55
55
|
//# 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, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F 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, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N 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-vyjR-9Z7.cjs';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F 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, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N 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-vyjR-9Z7.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, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F 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, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N 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-vyjR-9Z7.js';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F 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, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N 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-vyjR-9Z7.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/auth/index.js
CHANGED
|
@@ -851,6 +851,15 @@ var MemoryTokenStorage = (_class3 = class {
|
|
|
851
851
|
}, _class3);
|
|
852
852
|
|
|
853
853
|
// src/auth/OAuthProxy.ts
|
|
854
|
+
var RESERVED_AUTHORIZATION_PARAMS = /* @__PURE__ */ new Set([
|
|
855
|
+
"client_id",
|
|
856
|
+
"code_challenge",
|
|
857
|
+
"code_challenge_method",
|
|
858
|
+
"redirect_uri",
|
|
859
|
+
"response_type",
|
|
860
|
+
"scope",
|
|
861
|
+
"state"
|
|
862
|
+
]);
|
|
854
863
|
var OAuthProxy = (_class4 = class {
|
|
855
864
|
__init5() {this.claimsExtractor = null}
|
|
856
865
|
__init6() {this.cleanupInterval = null}
|
|
@@ -1733,6 +1742,15 @@ var OAuthProxy = (_class4 = class {
|
|
|
1733
1742
|
*/
|
|
1734
1743
|
redirectToUpstream(transaction) {
|
|
1735
1744
|
const authUrl = new URL(this.config.upstreamAuthorizationEndpoint);
|
|
1745
|
+
if (this.config.extraAuthorizationParams) {
|
|
1746
|
+
for (const [key, value] of Object.entries(
|
|
1747
|
+
this.config.extraAuthorizationParams
|
|
1748
|
+
)) {
|
|
1749
|
+
if (!RESERVED_AUTHORIZATION_PARAMS.has(key)) {
|
|
1750
|
+
authUrl.searchParams.set(key, value);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1736
1754
|
authUrl.searchParams.set("client_id", this.config.upstreamClientId);
|
|
1737
1755
|
authUrl.searchParams.set(
|
|
1738
1756
|
"redirect_uri",
|
|
@@ -2392,4 +2410,4 @@ Original error: ${error.message}`
|
|
|
2392
2410
|
|
|
2393
2411
|
|
|
2394
2412
|
exports.getAuthSession = getAuthSession; exports.requireAll = requireAll; exports.requireAny = requireAny; exports.requireAuth = requireAuth; exports.requireRole = requireRole; exports.requireScopes = requireScopes; exports.DEFAULT_ACCESS_TOKEN_TTL = DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_REFRESH_TOKEN_TTL = DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_AUTHORIZATION_CODE_TTL = DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_TRANSACTION_TTL = DEFAULT_TRANSACTION_TTL; exports.ConsentManager = ConsentManager; exports.JWTIssuer = JWTIssuer; exports.PKCEUtils = PKCEUtils; exports.EncryptedTokenStorage = EncryptedTokenStorage; exports.MemoryTokenStorage = MemoryTokenStorage; exports.OAuthProxy = OAuthProxy; exports.OAuthProxyError = OAuthProxyError; exports.AuthProvider = AuthProvider; exports.AzureProvider = AzureProvider; exports.GitHubProvider = GitHubProvider; exports.GoogleProvider = GoogleProvider; exports.OAuthProvider = OAuthProvider; exports.DiskStore = DiskStore; exports.JWKSVerifier = JWKSVerifier;
|
|
2395
|
-
//# sourceMappingURL=chunk-
|
|
2413
|
+
//# sourceMappingURL=chunk-JFLKZGBG.cjs.map
|