@absolutejs/auth 0.75.1 → 0.75.3
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 +21 -2
- package/dist/agents/config.d.ts +5 -1
- package/dist/agents/index.js +2 -1
- package/dist/agents/index.js.map +3 -3
- package/dist/agents/routes.d.ts +2 -0
- package/dist/cli/migrate.js +8 -2
- package/dist/cli/migrate.js.map +4 -4
- package/dist/client/dpop.d.ts +34 -0
- package/dist/client/dpop.test.d.ts +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +101 -3
- package/dist/client/index.js.map +4 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -2
- package/dist/index.js.map +7 -7
- package/dist/oidc/config.d.ts +2 -1
- package/dist/oidc/index.js +4 -1
- package/dist/oidc/index.js.map +3 -3
- package/dist/oidc/postgresStores.d.ts +15 -0
- package/dist/oidc/routes.d.ts +1 -0
- package/dist/oidc/types.d.ts +1 -0
- package/dist/server.js +16 -2
- package/dist/server.js.map +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -300,8 +300,9 @@ const authPlugin = await auth({
|
|
|
300
300
|
|
|
301
301
|
With `registerDynamicClients` enabled, an RFC 7591 client becomes an agent
|
|
302
302
|
registration. Approval through the existing RFC 8628 device flow creates the
|
|
303
|
-
user-to-agent delegation.
|
|
304
|
-
|
|
303
|
+
user-to-agent delegation. Send the RFC 8707 `resource` value with device
|
|
304
|
+
authorization to bind the resulting token directly to the protected API, or
|
|
305
|
+
use RFC 8693 token exchange when narrowing an existing user token.
|
|
305
306
|
|
|
306
307
|
When `requireDpop` is enabled, the adapter accepts only an RFC 9449-bound
|
|
307
308
|
access token using the `DPoP` authorization scheme, verifies its per-request
|
|
@@ -313,6 +314,24 @@ claims containing query or fragment components fail closed. Resource servers
|
|
|
313
314
|
that require RFC 9449 nonces can use the nonce helpers exported by
|
|
314
315
|
`@absolutejs/auth/oidc` to issue a separate resource nonce challenge.
|
|
315
316
|
|
|
317
|
+
Client applications can use `createDpopClient` from `@absolutejs/auth/client`.
|
|
318
|
+
It creates a non-exportable P-256 private key, signs a fresh proof for every
|
|
319
|
+
request, adds `ath` and the case-sensitive `DPoP` authorization scheme when an
|
|
320
|
+
access token is supplied, and retries one authorization- or resource-server
|
|
321
|
+
nonce challenge. Give the two servers distinct `nonceScope` values when they
|
|
322
|
+
share an origin. Redirects remain manual so credentials and proofs are never
|
|
323
|
+
forwarded to an unverified location.
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
import { createDpopClient } from '@absolutejs/auth/client';
|
|
327
|
+
|
|
328
|
+
const dpop = await createDpopClient();
|
|
329
|
+
const response = await dpop.fetch(resourceUrl, {
|
|
330
|
+
dpop: { accessToken, nonceScope: protectedResource },
|
|
331
|
+
method: 'POST'
|
|
332
|
+
});
|
|
333
|
+
```
|
|
334
|
+
|
|
316
335
|
```ts
|
|
317
336
|
app.get('/documents', ({ protectAgent }) =>
|
|
318
337
|
protectAgent(['documents:read'], (agent) => ({
|
package/dist/agents/config.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ export type AgentAuthConfig = {
|
|
|
25
25
|
oauthGuide?: AgentOAuthGuideConfig;
|
|
26
26
|
authorizationServer: string;
|
|
27
27
|
delegationStore: AgentDelegationStore;
|
|
28
|
+
/** Advertise RFC 9728 `dpop_bound_access_tokens_required`. Keep this aligned
|
|
29
|
+
* with a credential verifier configured with `requireDpop: true`. */
|
|
30
|
+
dpopBoundAccessTokensRequired?: boolean;
|
|
28
31
|
logoUri?: string;
|
|
29
32
|
metadataRoute?: RouteString;
|
|
30
33
|
/** Authorization-server route prefix. Defaults to `/oauth2`; used to derive
|
|
@@ -39,11 +42,12 @@ export type AgentAuthConfig = {
|
|
|
39
42
|
scopes: string[];
|
|
40
43
|
verifyCredential: AgentCredentialVerifier;
|
|
41
44
|
};
|
|
42
|
-
export declare const agentProtectedResourceMetadata: (config: Pick<AgentAuthConfig, "authorizationServer" | "logoUri" | "resource" | "resourceName" | "scopes">) => {
|
|
45
|
+
export declare const agentProtectedResourceMetadata: (config: Pick<AgentAuthConfig, "authorizationServer" | "dpopBoundAccessTokensRequired" | "logoUri" | "resource" | "resourceName" | "scopes">) => {
|
|
43
46
|
resource: string;
|
|
44
47
|
scopes_supported: string[];
|
|
45
48
|
resource_name?: string | undefined;
|
|
46
49
|
resource_logo_uri?: string | undefined;
|
|
50
|
+
dpop_bound_access_tokens_required?: boolean | undefined;
|
|
47
51
|
authorization_servers: string[];
|
|
48
52
|
bearer_methods_supported: string[];
|
|
49
53
|
};
|
package/dist/agents/index.js
CHANGED
|
@@ -186,6 +186,7 @@ var DEFAULT_AGENT_RESOURCE_METADATA_ROUTE = "/.well-known/oauth-protected-resour
|
|
|
186
186
|
var agentProtectedResourceMetadata = (config) => ({
|
|
187
187
|
authorization_servers: [config.authorizationServer],
|
|
188
188
|
bearer_methods_supported: ["header"],
|
|
189
|
+
...config.dpopBoundAccessTokensRequired === true ? { dpop_bound_access_tokens_required: true } : {},
|
|
189
190
|
...config.logoUri === undefined ? {} : { resource_logo_uri: config.logoUri },
|
|
190
191
|
...config.resourceName === undefined ? {} : { resource_name: config.resourceName },
|
|
191
192
|
resource: config.resource,
|
|
@@ -13798,5 +13799,5 @@ export {
|
|
|
13798
13799
|
AGENT_CLAIM_GRANT_TYPE
|
|
13799
13800
|
};
|
|
13800
13801
|
|
|
13801
|
-
//# debugId=
|
|
13802
|
+
//# debugId=16DE04B83F43B7D264756E2164756E21
|
|
13802
13803
|
//# sourceMappingURL=index.js.map
|