@ttoss/http-server-auth 0.8.5 → 0.10.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 +1 -1
- package/dist/index.cjs +11 -10
- package/dist/index.d.cts +16 -11
- package/dist/index.d.mts +16 -11
- package/dist/index.mjs +2 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -176,6 +176,6 @@ The package also ships `oauthServer()` — a Koa `Router` that issues tokens (`/
|
|
|
176
176
|
|
|
177
177
|
### Protected resource metadata (RFC 9728)
|
|
178
178
|
|
|
179
|
-
Passing `resource` to `oauthServer()` serves the protected-resource metadata document; `createProtectedResourceMetadataMiddleware` serves the same document when you bring your own auth middleware. Both answer at **every** location RFC 9728 defines for that resource — the root, plus the path-derived `/.well-known/oauth-protected-resource<path>` when the resource identifier carries a path, since §3.1 inserts the well-known segment between host and path. The locations and the document body come from `protectedResourceMetadataPaths` / `protectedResourceMetadataDocument` in `@ttoss/auth-core` (re-exported here), which is also what `getWwwAuthenticateHeader` derives its URL from — so the header and the routes cannot disagree.
|
|
179
|
+
Passing `resource` to `oauthServer()` serves the protected-resource metadata document; `createProtectedResourceMetadataMiddleware` serves the same document when you bring your own auth middleware. Both answer at **every** location RFC 9728 defines for that resource — the root, plus the path-derived `/.well-known/oauth-protected-resource<path>` when the resource identifier carries a path, since §3.1 inserts the well-known segment between host and path. The locations and the document body come from `protectedResourceMetadataPaths` / `protectedResourceMetadataDocument` in `@ttoss/auth-core` (re-exported here), which is also what `getWwwAuthenticateHeader` derives its URL from — so the header and the routes cannot disagree. `oauthServer()` advertises its `scopesSupported` as the document's `scopes_supported`; pass `scopesSupported` to `createProtectedResourceMetadataMiddleware` for the same.
|
|
180
180
|
|
|
181
181
|
Mount either **before** `authMiddleware`: clients fetch discovery before they have a token.
|
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
23
|
}
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
27
27
|
value: mod,
|
|
28
28
|
enumerable: true
|
|
29
29
|
}) : target, mod));
|
|
@@ -326,7 +326,8 @@ var createProtectedResourceMetadataMiddleware = args => {
|
|
|
326
326
|
}));
|
|
327
327
|
const body = (0, _ttoss_auth_core.protectedResourceMetadataDocument)({
|
|
328
328
|
resource: args.resource,
|
|
329
|
-
authorizationServers: args.authorizationServers
|
|
329
|
+
authorizationServers: args.authorizationServers,
|
|
330
|
+
scopesSupported: args.scopesSupported
|
|
330
331
|
});
|
|
331
332
|
return async (ctx, next) => {
|
|
332
333
|
if (ctx.method === "GET" && metadataPaths.has(ctx.path)) {
|
|
@@ -355,13 +356,13 @@ var requireAuth = options => {
|
|
|
355
356
|
|
|
356
357
|
//#endregion
|
|
357
358
|
exports.authMiddleware = authMiddleware;
|
|
358
|
-
Object.defineProperty(exports,
|
|
359
|
+
Object.defineProperty(exports, "createEmailAuthHandlers", {
|
|
359
360
|
enumerable: true,
|
|
360
361
|
get: function () {
|
|
361
362
|
return _ttoss_auth_core.createEmailAuthHandlers;
|
|
362
363
|
}
|
|
363
364
|
});
|
|
364
|
-
Object.defineProperty(exports,
|
|
365
|
+
Object.defineProperty(exports, "createOAuthHandlers", {
|
|
365
366
|
enumerable: true,
|
|
366
367
|
get: function () {
|
|
367
368
|
return _ttoss_auth_core.createOAuthHandlers;
|
|
@@ -369,39 +370,39 @@ Object.defineProperty(exports, 'createOAuthHandlers', {
|
|
|
369
370
|
});
|
|
370
371
|
exports.createProtectedResourceMetadataMiddleware = createProtectedResourceMetadataMiddleware;
|
|
371
372
|
exports.emailAuth = emailAuth;
|
|
372
|
-
Object.defineProperty(exports,
|
|
373
|
+
Object.defineProperty(exports, "emailAuthErrorCodes", {
|
|
373
374
|
enumerable: true,
|
|
374
375
|
get: function () {
|
|
375
376
|
return _ttoss_auth_core.emailAuthErrorCodes;
|
|
376
377
|
}
|
|
377
378
|
});
|
|
378
|
-
Object.defineProperty(exports,
|
|
379
|
+
Object.defineProperty(exports, "getWwwAuthenticateHeader", {
|
|
379
380
|
enumerable: true,
|
|
380
381
|
get: function () {
|
|
381
382
|
return _ttoss_auth_core.getWwwAuthenticateHeader;
|
|
382
383
|
}
|
|
383
384
|
});
|
|
384
385
|
exports.isOriginAllowed = isOriginAllowed;
|
|
385
|
-
Object.defineProperty(exports,
|
|
386
|
+
Object.defineProperty(exports, "normalizeEmail", {
|
|
386
387
|
enumerable: true,
|
|
387
388
|
get: function () {
|
|
388
389
|
return _ttoss_auth_core.normalizeEmail;
|
|
389
390
|
}
|
|
390
391
|
});
|
|
391
392
|
exports.oauthServer = oauthServer;
|
|
392
|
-
Object.defineProperty(exports,
|
|
393
|
+
Object.defineProperty(exports, "protectedResourceMetadataDocument", {
|
|
393
394
|
enumerable: true,
|
|
394
395
|
get: function () {
|
|
395
396
|
return _ttoss_auth_core.protectedResourceMetadataDocument;
|
|
396
397
|
}
|
|
397
398
|
});
|
|
398
|
-
Object.defineProperty(exports,
|
|
399
|
+
Object.defineProperty(exports, "protectedResourceMetadataPaths", {
|
|
399
400
|
enumerable: true,
|
|
400
401
|
get: function () {
|
|
401
402
|
return _ttoss_auth_core.protectedResourceMetadataPaths;
|
|
402
403
|
}
|
|
403
404
|
});
|
|
404
|
-
Object.defineProperty(exports,
|
|
405
|
+
Object.defineProperty(exports, "protectedResourceMetadataUrl", {
|
|
405
406
|
enumerable: true,
|
|
406
407
|
get: function () {
|
|
407
408
|
return _ttoss_auth_core.protectedResourceMetadataUrl;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { Context, Middleware, Next, Router } from "@ttoss/http-server";
|
|
3
3
|
import { AuthCodeStore, AuthorizeRequest, ClientStore, EmailAuthDelivery, EmailAuthErrorCode, EmailAuthHandler, EmailAuthHandlers, EmailAuthHooks, EmailAuthMode, EmailAuthOptions, EmailAuthOptions as EmailAuthOptions$1, EmailAuthPaths, EmailAuthSession, EmailAuthTtl, EmailAuthUser, EmailAuthUserStore, EmailCodeOptions, IssueTokensArgs, IssuedTokens, OAuthClient, OAuthClientMetadata, OAuthHandlers, OAuthServerOptions, OAuthServerOptions as OAuthServerOptions$1, OnAuthorizeArgs, OnAuthorizeResult, OnRefreshTokenArgs, OnRefreshTokenResult, OneTimeTokenPurpose, OneTimeTokenStore, PasswordOptions, ProtectedResourceMetadata, RequestRateLimit, RequestRateLimitStore, StoredAuthorizationCode, StoredOneTimeToken, createEmailAuthHandlers, createOAuthHandlers, emailAuthErrorCodes, getWwwAuthenticateHeader, normalizeEmail, protectedResourceMetadataDocument, protectedResourceMetadataPaths, protectedResourceMetadataUrl } from "@ttoss/auth-core";
|
|
4
|
-
|
|
5
4
|
//#region src/types.d.ts
|
|
6
5
|
type AuthenticatedUser = {
|
|
7
6
|
id: string;
|
|
@@ -31,7 +30,8 @@ type ApiTokenOptions = {
|
|
|
31
30
|
lookup: (tokenHash: string, ctx: Context) => Promise<AuthenticatedUser | null>;
|
|
32
31
|
};
|
|
33
32
|
type SystemOptions = {
|
|
34
|
-
secret: string;
|
|
33
|
+
secret: string;
|
|
34
|
+
/** User attached to ctx.state.user for system calls. */
|
|
35
35
|
user: AuthenticatedUser;
|
|
36
36
|
};
|
|
37
37
|
type OAuthOptions = {
|
|
@@ -59,7 +59,8 @@ type OAuthOptions = {
|
|
|
59
59
|
requiredScopes?: string[];
|
|
60
60
|
};
|
|
61
61
|
type AuthMiddlewareOptions = {
|
|
62
|
-
/** Ordered list of strategies to attempt. First match wins. */
|
|
62
|
+
/** Ordered list of strategies to attempt. First match wins. */
|
|
63
|
+
strategies: AuthStrategy[];
|
|
63
64
|
jwt?: JwtOptions;
|
|
64
65
|
apiToken?: ApiTokenOptions;
|
|
65
66
|
system?: SystemOptions;
|
|
@@ -91,7 +92,7 @@ type AuthMiddlewareOptions = {
|
|
|
91
92
|
* header, RFC 9728 when `resourceMetadataUrl` is set) for missing/invalid
|
|
92
93
|
* tokens, and `403` when a verified token is missing a required scope.
|
|
93
94
|
*/
|
|
94
|
-
declare const authMiddleware: (options: AuthMiddlewareOptions) => (ctx: Context, next: Next) => Promise<void>;
|
|
95
|
+
export declare const authMiddleware: (options: AuthMiddlewareOptions) => (ctx: Context, next: Next) => Promise<void>;
|
|
95
96
|
//#endregion
|
|
96
97
|
//#region src/emailAuth.d.ts
|
|
97
98
|
/**
|
|
@@ -128,7 +129,7 @@ declare const authMiddleware: (options: AuthMiddlewareOptions) => (ctx: Context,
|
|
|
128
129
|
* );
|
|
129
130
|
* ```
|
|
130
131
|
*/
|
|
131
|
-
declare const emailAuth: (options: EmailAuthOptions$1 & {
|
|
132
|
+
export declare const emailAuth: (options: EmailAuthOptions$1 & {
|
|
132
133
|
/**
|
|
133
134
|
* Prefix applied to every mounted path, e.g. `/v1`. Useful when the app
|
|
134
135
|
* versions its API and the engine's default paths are otherwise fine.
|
|
@@ -156,7 +157,7 @@ declare const emailAuth: (options: EmailAuthOptions$1 & {
|
|
|
156
157
|
* app.use(oauthServer({ issuer, clientStore, authCodeStore, issueTokens, onAuthorize }).routes());
|
|
157
158
|
* ```
|
|
158
159
|
*/
|
|
159
|
-
declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
160
|
+
export declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
160
161
|
/**
|
|
161
162
|
* Koa middleware that serves the RFC 9728 Protected Resource Metadata
|
|
162
163
|
* document. Mount it **before** `authMiddleware` so the discovery endpoint
|
|
@@ -166,9 +167,13 @@ declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
|
166
167
|
* the resource: the root, plus the path-derived location of RFC 9728 §3.1 when
|
|
167
168
|
* the resource identifier carries a path.
|
|
168
169
|
*/
|
|
169
|
-
declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
170
|
-
/** The protected resource's identifier URI. */
|
|
170
|
+
export declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
171
|
+
/** The protected resource's identifier URI. */
|
|
172
|
+
resource: string;
|
|
173
|
+
/** Authorization server issuer URIs that issue tokens for this resource. */
|
|
171
174
|
authorizationServers: string[];
|
|
175
|
+
/** Scopes this resource accepts, advertised as `scopes_supported`. */
|
|
176
|
+
scopesSupported?: string[];
|
|
172
177
|
}) => Middleware;
|
|
173
178
|
//#endregion
|
|
174
179
|
//#region src/origin.d.ts
|
|
@@ -176,7 +181,7 @@ declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
|
176
181
|
* Returns true if origin matches any entry in the allowlist.
|
|
177
182
|
* Strings are compared exactly; RegExps are tested.
|
|
178
183
|
*/
|
|
179
|
-
declare const isOriginAllowed: (origin: string, allowedOrigins: Array<string | RegExp | undefined>) => boolean;
|
|
184
|
+
export declare const isOriginAllowed: (origin: string, allowedOrigins: Array<string | RegExp | undefined>) => boolean;
|
|
180
185
|
//#endregion
|
|
181
186
|
//#region src/requireAuth.d.ts
|
|
182
187
|
/**
|
|
@@ -186,6 +191,6 @@ declare const isOriginAllowed: (origin: string, allowedOrigins: Array<string | R
|
|
|
186
191
|
* @example
|
|
187
192
|
* router.get('/me', requireAuth({ strategies: ['jwt', 'apiToken'] }), handler);
|
|
188
193
|
*/
|
|
189
|
-
declare const requireAuth: (options: AuthMiddlewareOptions) => ((ctx: Context, next: Next) => Promise<void>);
|
|
194
|
+
export declare const requireAuth: (options: AuthMiddlewareOptions) => ((ctx: Context, next: Next) => Promise<void>);
|
|
190
195
|
//#endregion
|
|
191
|
-
export { type ApiTokenOptions, type AuthCodeStore, type AuthMiddlewareOptions, type AuthStrategy, type AuthenticatedUser, type AuthorizeRequest, type ClientStore, type EmailAuthDelivery, type EmailAuthErrorCode, type EmailAuthHandler, type EmailAuthHandlers, type EmailAuthHooks, type EmailAuthMode, type EmailAuthOptions, type EmailAuthPaths, type EmailAuthSession, type EmailAuthTtl, type EmailAuthUser, type EmailAuthUserStore, type EmailCodeOptions, type IssueTokensArgs, type IssuedTokens, type JwtOptions, type OAuthClient, type OAuthClientMetadata, type OAuthHandlers, type OAuthOptions, type OAuthServerOptions, type OnAuthorizeArgs, type OnAuthorizeResult, type OnRefreshTokenArgs, type OnRefreshTokenResult, type OneTimeTokenPurpose, type OneTimeTokenStore, type PasswordOptions, type ProtectedResourceMetadata, type RequestRateLimit, type RequestRateLimitStore, type StoredAuthorizationCode, type StoredOneTimeToken, type SystemOptions,
|
|
196
|
+
export { type ApiTokenOptions, type AuthCodeStore, type AuthMiddlewareOptions, type AuthStrategy, type AuthenticatedUser, type AuthorizeRequest, type ClientStore, type EmailAuthDelivery, type EmailAuthErrorCode, type EmailAuthHandler, type EmailAuthHandlers, type EmailAuthHooks, type EmailAuthMode, type EmailAuthOptions, type EmailAuthPaths, type EmailAuthSession, type EmailAuthTtl, type EmailAuthUser, type EmailAuthUserStore, type EmailCodeOptions, type IssueTokensArgs, type IssuedTokens, type JwtOptions, type OAuthClient, type OAuthClientMetadata, type OAuthHandlers, type OAuthOptions, type OAuthServerOptions, type OnAuthorizeArgs, type OnAuthorizeResult, type OnRefreshTokenArgs, type OnRefreshTokenResult, type OneTimeTokenPurpose, type OneTimeTokenStore, type PasswordOptions, type ProtectedResourceMetadata, type RequestRateLimit, type RequestRateLimitStore, type StoredAuthorizationCode, type StoredOneTimeToken, type SystemOptions, createEmailAuthHandlers, createOAuthHandlers, emailAuthErrorCodes, getWwwAuthenticateHeader, normalizeEmail, protectedResourceMetadataDocument, protectedResourceMetadataPaths, protectedResourceMetadataUrl };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { AuthCodeStore, AuthorizeRequest, ClientStore, EmailAuthDelivery, EmailAuthErrorCode, EmailAuthHandler, EmailAuthHandlers, EmailAuthHooks, EmailAuthMode, EmailAuthOptions, EmailAuthOptions as EmailAuthOptions$1, EmailAuthPaths, EmailAuthSession, EmailAuthTtl, EmailAuthUser, EmailAuthUserStore, EmailCodeOptions, IssueTokensArgs, IssuedTokens, OAuthClient, OAuthClientMetadata, OAuthHandlers, OAuthServerOptions, OAuthServerOptions as OAuthServerOptions$1, OnAuthorizeArgs, OnAuthorizeResult, OnRefreshTokenArgs, OnRefreshTokenResult, OneTimeTokenPurpose, OneTimeTokenStore, PasswordOptions, ProtectedResourceMetadata, RequestRateLimit, RequestRateLimitStore, StoredAuthorizationCode, StoredOneTimeToken, createEmailAuthHandlers, createOAuthHandlers, emailAuthErrorCodes, getWwwAuthenticateHeader, normalizeEmail, protectedResourceMetadataDocument, protectedResourceMetadataPaths, protectedResourceMetadataUrl } from "@ttoss/auth-core";
|
|
3
3
|
import { Context, Middleware, Next, Router } from "@ttoss/http-server";
|
|
4
|
-
|
|
5
4
|
//#region src/types.d.ts
|
|
6
5
|
type AuthenticatedUser = {
|
|
7
6
|
id: string;
|
|
@@ -31,7 +30,8 @@ type ApiTokenOptions = {
|
|
|
31
30
|
lookup: (tokenHash: string, ctx: Context) => Promise<AuthenticatedUser | null>;
|
|
32
31
|
};
|
|
33
32
|
type SystemOptions = {
|
|
34
|
-
secret: string;
|
|
33
|
+
secret: string;
|
|
34
|
+
/** User attached to ctx.state.user for system calls. */
|
|
35
35
|
user: AuthenticatedUser;
|
|
36
36
|
};
|
|
37
37
|
type OAuthOptions = {
|
|
@@ -59,7 +59,8 @@ type OAuthOptions = {
|
|
|
59
59
|
requiredScopes?: string[];
|
|
60
60
|
};
|
|
61
61
|
type AuthMiddlewareOptions = {
|
|
62
|
-
/** Ordered list of strategies to attempt. First match wins. */
|
|
62
|
+
/** Ordered list of strategies to attempt. First match wins. */
|
|
63
|
+
strategies: AuthStrategy[];
|
|
63
64
|
jwt?: JwtOptions;
|
|
64
65
|
apiToken?: ApiTokenOptions;
|
|
65
66
|
system?: SystemOptions;
|
|
@@ -91,7 +92,7 @@ type AuthMiddlewareOptions = {
|
|
|
91
92
|
* header, RFC 9728 when `resourceMetadataUrl` is set) for missing/invalid
|
|
92
93
|
* tokens, and `403` when a verified token is missing a required scope.
|
|
93
94
|
*/
|
|
94
|
-
declare const authMiddleware: (options: AuthMiddlewareOptions) => (ctx: Context, next: Next) => Promise<void>;
|
|
95
|
+
export declare const authMiddleware: (options: AuthMiddlewareOptions) => (ctx: Context, next: Next) => Promise<void>;
|
|
95
96
|
//#endregion
|
|
96
97
|
//#region src/emailAuth.d.ts
|
|
97
98
|
/**
|
|
@@ -128,7 +129,7 @@ declare const authMiddleware: (options: AuthMiddlewareOptions) => (ctx: Context,
|
|
|
128
129
|
* );
|
|
129
130
|
* ```
|
|
130
131
|
*/
|
|
131
|
-
declare const emailAuth: (options: EmailAuthOptions$1 & {
|
|
132
|
+
export declare const emailAuth: (options: EmailAuthOptions$1 & {
|
|
132
133
|
/**
|
|
133
134
|
* Prefix applied to every mounted path, e.g. `/v1`. Useful when the app
|
|
134
135
|
* versions its API and the engine's default paths are otherwise fine.
|
|
@@ -156,7 +157,7 @@ declare const emailAuth: (options: EmailAuthOptions$1 & {
|
|
|
156
157
|
* app.use(oauthServer({ issuer, clientStore, authCodeStore, issueTokens, onAuthorize }).routes());
|
|
157
158
|
* ```
|
|
158
159
|
*/
|
|
159
|
-
declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
160
|
+
export declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
160
161
|
/**
|
|
161
162
|
* Koa middleware that serves the RFC 9728 Protected Resource Metadata
|
|
162
163
|
* document. Mount it **before** `authMiddleware` so the discovery endpoint
|
|
@@ -166,9 +167,13 @@ declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
|
166
167
|
* the resource: the root, plus the path-derived location of RFC 9728 §3.1 when
|
|
167
168
|
* the resource identifier carries a path.
|
|
168
169
|
*/
|
|
169
|
-
declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
170
|
-
/** The protected resource's identifier URI. */
|
|
170
|
+
export declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
171
|
+
/** The protected resource's identifier URI. */
|
|
172
|
+
resource: string;
|
|
173
|
+
/** Authorization server issuer URIs that issue tokens for this resource. */
|
|
171
174
|
authorizationServers: string[];
|
|
175
|
+
/** Scopes this resource accepts, advertised as `scopes_supported`. */
|
|
176
|
+
scopesSupported?: string[];
|
|
172
177
|
}) => Middleware;
|
|
173
178
|
//#endregion
|
|
174
179
|
//#region src/origin.d.ts
|
|
@@ -176,7 +181,7 @@ declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
|
176
181
|
* Returns true if origin matches any entry in the allowlist.
|
|
177
182
|
* Strings are compared exactly; RegExps are tested.
|
|
178
183
|
*/
|
|
179
|
-
declare const isOriginAllowed: (origin: string, allowedOrigins: Array<string | RegExp | undefined>) => boolean;
|
|
184
|
+
export declare const isOriginAllowed: (origin: string, allowedOrigins: Array<string | RegExp | undefined>) => boolean;
|
|
180
185
|
//#endregion
|
|
181
186
|
//#region src/requireAuth.d.ts
|
|
182
187
|
/**
|
|
@@ -186,6 +191,6 @@ declare const isOriginAllowed: (origin: string, allowedOrigins: Array<string | R
|
|
|
186
191
|
* @example
|
|
187
192
|
* router.get('/me', requireAuth({ strategies: ['jwt', 'apiToken'] }), handler);
|
|
188
193
|
*/
|
|
189
|
-
declare const requireAuth: (options: AuthMiddlewareOptions) => ((ctx: Context, next: Next) => Promise<void>);
|
|
194
|
+
export declare const requireAuth: (options: AuthMiddlewareOptions) => ((ctx: Context, next: Next) => Promise<void>);
|
|
190
195
|
//#endregion
|
|
191
|
-
export { type ApiTokenOptions, type AuthCodeStore, type AuthMiddlewareOptions, type AuthStrategy, type AuthenticatedUser, type AuthorizeRequest, type ClientStore, type EmailAuthDelivery, type EmailAuthErrorCode, type EmailAuthHandler, type EmailAuthHandlers, type EmailAuthHooks, type EmailAuthMode, type EmailAuthOptions, type EmailAuthPaths, type EmailAuthSession, type EmailAuthTtl, type EmailAuthUser, type EmailAuthUserStore, type EmailCodeOptions, type IssueTokensArgs, type IssuedTokens, type JwtOptions, type OAuthClient, type OAuthClientMetadata, type OAuthHandlers, type OAuthOptions, type OAuthServerOptions, type OnAuthorizeArgs, type OnAuthorizeResult, type OnRefreshTokenArgs, type OnRefreshTokenResult, type OneTimeTokenPurpose, type OneTimeTokenStore, type PasswordOptions, type ProtectedResourceMetadata, type RequestRateLimit, type RequestRateLimitStore, type StoredAuthorizationCode, type StoredOneTimeToken, type SystemOptions,
|
|
196
|
+
export { type ApiTokenOptions, type AuthCodeStore, type AuthMiddlewareOptions, type AuthStrategy, type AuthenticatedUser, type AuthorizeRequest, type ClientStore, type EmailAuthDelivery, type EmailAuthErrorCode, type EmailAuthHandler, type EmailAuthHandlers, type EmailAuthHooks, type EmailAuthMode, type EmailAuthOptions, type EmailAuthPaths, type EmailAuthSession, type EmailAuthTtl, type EmailAuthUser, type EmailAuthUserStore, type EmailCodeOptions, type IssueTokensArgs, type IssuedTokens, type JwtOptions, type OAuthClient, type OAuthClientMetadata, type OAuthHandlers, type OAuthOptions, type OAuthServerOptions, type OnAuthorizeArgs, type OnAuthorizeResult, type OnRefreshTokenArgs, type OnRefreshTokenResult, type OneTimeTokenPurpose, type OneTimeTokenStore, type PasswordOptions, type ProtectedResourceMetadata, type RequestRateLimit, type RequestRateLimitStore, type StoredAuthorizationCode, type StoredOneTimeToken, type SystemOptions, createEmailAuthHandlers, createOAuthHandlers, emailAuthErrorCodes, getWwwAuthenticateHeader, normalizeEmail, protectedResourceMetadataDocument, protectedResourceMetadataPaths, protectedResourceMetadataUrl };
|
package/dist/index.mjs
CHANGED
|
@@ -295,7 +295,8 @@ var createProtectedResourceMetadataMiddleware = args => {
|
|
|
295
295
|
}));
|
|
296
296
|
const body = protectedResourceMetadataDocument$1({
|
|
297
297
|
resource: args.resource,
|
|
298
|
-
authorizationServers: args.authorizationServers
|
|
298
|
+
authorizationServers: args.authorizationServers,
|
|
299
|
+
scopesSupported: args.scopesSupported
|
|
299
300
|
});
|
|
300
301
|
return async (ctx, next) => {
|
|
301
302
|
if (ctx.method === "GET" && metadataPaths.has(ctx.path)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/http-server-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Authentication middleware for @ttoss/http-server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ttoss/auth-core": "^0.
|
|
35
|
+
"@ttoss/auth-core": "^0.19.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/koa": "^3.0.3",
|
|
39
|
-
"jest": "^30.
|
|
40
|
-
"supertest": "^7.
|
|
41
|
-
"tsdown": "^0.
|
|
42
|
-
"@ttoss/
|
|
43
|
-
"@ttoss/
|
|
39
|
+
"jest": "^30.5.2",
|
|
40
|
+
"supertest": "^7.3.1",
|
|
41
|
+
"tsdown": "^0.23.1",
|
|
42
|
+
"@ttoss/http-server": "^0.14.0",
|
|
43
|
+
"@ttoss/config": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@ttoss/http-server": "^0.
|
|
46
|
+
"@ttoss/http-server": "^0.14.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public",
|