@ttoss/http-server-auth 0.8.4 → 0.9.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 +2 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +4 -4
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
|
@@ -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)) {
|
package/dist/index.d.cts
CHANGED
|
@@ -168,7 +168,8 @@ declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
|
168
168
|
*/
|
|
169
169
|
declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
170
170
|
/** The protected resource's identifier URI. */resource: string; /** Authorization server issuer URIs that issue tokens for this resource. */
|
|
171
|
-
authorizationServers: string[];
|
|
171
|
+
authorizationServers: string[]; /** Scopes this resource accepts, advertised as `scopes_supported`. */
|
|
172
|
+
scopesSupported?: string[];
|
|
172
173
|
}) => Middleware;
|
|
173
174
|
//#endregion
|
|
174
175
|
//#region src/origin.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -168,7 +168,8 @@ declare const oauthServer: (options: OAuthServerOptions$1) => Router;
|
|
|
168
168
|
*/
|
|
169
169
|
declare const createProtectedResourceMetadataMiddleware: (args: {
|
|
170
170
|
/** The protected resource's identifier URI. */resource: string; /** Authorization server issuer URIs that issue tokens for this resource. */
|
|
171
|
-
authorizationServers: string[];
|
|
171
|
+
authorizationServers: string[]; /** Scopes this resource accepts, advertised as `scopes_supported`. */
|
|
172
|
+
scopesSupported?: string[];
|
|
172
173
|
}) => Middleware;
|
|
173
174
|
//#endregion
|
|
174
175
|
//#region src/origin.d.ts
|
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.9.0",
|
|
4
4
|
"description": "Authentication middleware for @ttoss/http-server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ttoss/auth-core": "^0.
|
|
35
|
+
"@ttoss/auth-core": "^0.18.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/koa": "^3.0.3",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"supertest": "^7.2.2",
|
|
41
41
|
"tsdown": "^0.22.2",
|
|
42
42
|
"@ttoss/config": "^1.41.0",
|
|
43
|
-
"@ttoss/http-server": "^0.
|
|
43
|
+
"@ttoss/http-server": "^0.13.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@ttoss/http-server": "^0.
|
|
46
|
+
"@ttoss/http-server": "^0.13.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public",
|