@axa-fr/oidc-client-service-worker 7.29.8 → 7.30.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 +64 -0
- package/dist/OidcServiceWorker.d.ts +2 -1
- package/dist/OidcServiceWorker.d.ts.map +1 -0
- package/dist/OidcServiceWorker.js +995 -765
- package/dist/OidcServiceWorker.js.map +1 -1
- package/dist/constants.d.ts.map +1 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/dpop.d.ts.map +1 -0
- package/dist/jwt.d.ts.map +1 -0
- package/dist/oidcConfig.d.ts.map +1 -0
- package/dist/protocol.d.ts +140 -2
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +50 -2
- package/dist/protocol.js.map +1 -1
- package/dist/resource.d.ts +22 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/tokenContexts.d.ts +5 -0
- package/dist/tokenContexts.d.ts.map +1 -0
- package/dist/{src/types.d.ts → types.d.ts} +26 -1
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/codeVerifier.d.ts.map +1 -0
- package/dist/{src/utils → utils}/domains.d.ts +2 -2
- package/dist/utils/domains.d.ts.map +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/normalizeUrl.d.ts.map +1 -0
- package/dist/utils/serializeHeaders.d.ts.map +1 -0
- package/dist/utils/shouldBypassDestination.d.ts.map +1 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/strings.d.ts.map +1 -0
- package/dist/{src/utils → utils}/tokens.d.ts +12 -3
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/waitForValidTokens.d.ts.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/OidcServiceWorker.ts +290 -34
- package/src/__tests__/jwt.spec.ts +17 -0
- package/src/__tests__/resource.spec.ts +98 -0
- package/src/__tests__/workerResource.spec.ts +919 -0
- package/src/jwt.ts +4 -1
- package/src/oidcConfig.ts +2 -1
- package/src/protocol.ts +16 -1
- package/src/resource.ts +104 -0
- package/src/tokenContexts.ts +39 -0
- package/src/types.ts +27 -1
- package/src/utils/domains.ts +20 -2
- package/src/utils/tokens.ts +155 -8
- package/src/version.ts +1 -1
- package/dist/src/OidcServiceWorker.d.ts +0 -2
- package/dist/src/OidcServiceWorker.d.ts.map +0 -1
- package/dist/src/__tests__/jwt.spec.d.ts +0 -2
- package/dist/src/__tests__/jwt.spec.d.ts.map +0 -1
- package/dist/src/__tests__/oidcConfig.spec.d.ts +0 -2
- package/dist/src/__tests__/oidcConfig.spec.d.ts.map +0 -1
- package/dist/src/__tests__/protocol.spec.d.ts +0 -2
- package/dist/src/__tests__/protocol.spec.d.ts.map +0 -1
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/crypto.d.ts.map +0 -1
- package/dist/src/dpop.d.ts.map +0 -1
- package/dist/src/jwt.d.ts.map +0 -1
- package/dist/src/oidcConfig.d.ts.map +0 -1
- package/dist/src/protocol.d.ts +0 -134
- package/dist/src/protocol.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/__tests__/codeVerifier.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/codeVerifier.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/domains.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/domains.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/normalizeUrl.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/normalizeUrl.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/serializeHeaders.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/serializeHeaders.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/shouldBypassDestination.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/shouldBypassDestination.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/strings.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/strings.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/testHelper.d.ts +0 -58
- package/dist/src/utils/__tests__/testHelper.d.ts.map +0 -1
- package/dist/src/utils/__tests__/tokens.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/tokens.spec.d.ts.map +0 -1
- package/dist/src/utils/__tests__/waitForValidTokens.spec.d.ts +0 -2
- package/dist/src/utils/__tests__/waitForValidTokens.spec.d.ts.map +0 -1
- package/dist/src/utils/codeVerifier.d.ts.map +0 -1
- package/dist/src/utils/domains.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/normalizeUrl.d.ts.map +0 -1
- package/dist/src/utils/serializeHeaders.d.ts.map +0 -1
- package/dist/src/utils/shouldBypassDestination.d.ts.map +0 -1
- package/dist/src/utils/sleep.d.ts.map +0 -1
- package/dist/src/utils/strings.d.ts.map +0 -1
- package/dist/src/utils/tokens.d.ts.map +0 -1
- package/dist/src/utils/waitForValidTokens.d.ts.map +0 -1
- package/dist/src/version.d.ts +0 -3
- package/dist/src/version.d.ts.map +0 -1
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/crypto.d.ts → crypto.d.ts} +0 -0
- /package/dist/{src/dpop.d.ts → dpop.d.ts} +0 -0
- /package/dist/{src/jwt.d.ts → jwt.d.ts} +0 -0
- /package/dist/{src/oidcConfig.d.ts → oidcConfig.d.ts} +0 -0
- /package/dist/{src/utils → utils}/codeVerifier.d.ts +0 -0
- /package/dist/{src/utils → utils}/index.d.ts +0 -0
- /package/dist/{src/utils → utils}/normalizeUrl.d.ts +0 -0
- /package/dist/{src/utils → utils}/serializeHeaders.d.ts +0 -0
- /package/dist/{src/utils → utils}/shouldBypassDestination.d.ts +0 -0
- /package/dist/{src/utils → utils}/sleep.d.ts +0 -0
- /package/dist/{src/utils → utils}/strings.d.ts +0 -0
- /package/dist/{src/utils → utils}/waitForValidTokens.d.ts +0 -0
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ package directly. The clients handle worker registration and communication.
|
|
|
11
11
|
- [How it works](#how-it-works)
|
|
12
12
|
- [Getting started](#getting-started)
|
|
13
13
|
- [Trusted domains](#trusted-domains)
|
|
14
|
+
- [Resource-specific token isolation](#resource-specific-token-isolation)
|
|
14
15
|
- [Deployment and troubleshooting](#deployment-and-troubleshooting)
|
|
15
16
|
- [Protocol reference](#protocol-reference)
|
|
16
17
|
|
|
@@ -84,6 +85,69 @@ application JavaScript while keeping the refresh token in the worker.
|
|
|
84
85
|
Merge this with existing installation steps rather than replacing them.
|
|
85
86
|
Deploy the copied worker with every client upgrade.
|
|
86
87
|
|
|
88
|
+
## Resource-specific token isolation
|
|
89
|
+
|
|
90
|
+
Use the [local OpenIddict demos](../../examples/openiddict-server/README.md) to test
|
|
91
|
+
two isolated audiences and DPoP nonce challenges end to end. Their local trust
|
|
92
|
+
rules activate only for a localhost worker explicitly selected with
|
|
93
|
+
`provider=openiddict`; the online trust rules do not gain localhost access.
|
|
94
|
+
Generated DPoP targets exclude query strings and fragments.
|
|
95
|
+
|
|
96
|
+
The clients' [RFC 8707 resource API](../oidc-client/README.md#resource-indicators-and-multiple-apis)
|
|
97
|
+
uses nested resource entries in the existing named/tab session, not separate
|
|
98
|
+
OIDC clients. Access tokens, authorization state, PKCE, grant references, and
|
|
99
|
+
DPoP state remain associated with the selected resource. Default and sibling
|
|
100
|
+
access tokens are not replaced by acquisition or renewal.
|
|
101
|
+
Additional authorization requires a fresh ID token for the same authenticated
|
|
102
|
+
subject and transaction nonce. A resource refresh may omit an ID token even
|
|
103
|
+
after its earlier ID token expires.
|
|
104
|
+
|
|
105
|
+
Configure `resources` in the client and allow both API origins in the worker:
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
const trustedDomains = {
|
|
109
|
+
default: {
|
|
110
|
+
oidcDomains: [/^https:\/\/issuer\.example\.com(?:\/|$)/],
|
|
111
|
+
accessTokenDomains: [
|
|
112
|
+
/^https:\/\/orders\.example\.com(?:\/|$)/,
|
|
113
|
+
/^https:\/\/inventory\.example\.com(?:\/|$)/,
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Use `fetchForResource()` or `useOidcFetchForResource()`, not automatic selection
|
|
120
|
+
by URL. A selected placeholder must match its exact resource context and both
|
|
121
|
+
the client URL mapping and worker trusted-domain rules. Managed API requests
|
|
122
|
+
without resource selection do not receive an arbitrary/default worker token,
|
|
123
|
+
including paths outside the permitted prefixes on registered API origins.
|
|
124
|
+
The standard provider user-info flow retains its default token handling.
|
|
125
|
+
Default renewal also retains its own token entry for single-resource grants.
|
|
126
|
+
The client sends a worker-only routing hint for explicit resource refreshes;
|
|
127
|
+
the worker verifies it against the OAuth resource and removes it before dispatch.
|
|
128
|
+
Resource tokens are always masked, including with `showAccessToken: true`.
|
|
129
|
+
Automatic API redirects are rejected.
|
|
130
|
+
|
|
131
|
+
Shared refresh rotation is retained centrally; independently authorized
|
|
132
|
+
resources keep their own grants. Clearing a resource resets only its entry;
|
|
133
|
+
clearing the base session removes all nested entries. Late responses cannot
|
|
134
|
+
recreate cleared state. Logout can revoke resource tokens through the exact
|
|
135
|
+
trusted revocation endpoint.
|
|
136
|
+
|
|
137
|
+
DPoP remains configured through this file's existing options. Resource API
|
|
138
|
+
proofs use the selected real token and its bound key/nonce; the browser receives
|
|
139
|
+
neither refresh tokens nor private keys from the resource API.
|
|
140
|
+
API nonces are retained per resource separately from authorization-server
|
|
141
|
+
nonces. API responses are not automatically retried.
|
|
142
|
+
|
|
143
|
+
Resource support requires the `resourceTokenManagement` capability returned by
|
|
144
|
+
protocol 1.1 workers. Copy and deploy the matching `OidcServiceWorker.js` with
|
|
145
|
+
each client upgrade. Older/unavailable workers cause explicit resource errors,
|
|
146
|
+
not browser-token fallback. Worker token memory is not durable: after loss,
|
|
147
|
+
restore or reauthenticate the original session before requesting resource
|
|
148
|
+
tokens. Resource entries cannot be reconstructed from stale placeholders.
|
|
149
|
+
See the core guide for provider/opaque-token limitations.
|
|
150
|
+
|
|
87
151
|
## Trusted domains
|
|
88
152
|
|
|
89
153
|
Keep provider endpoints and API destinations separate:
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=OidcServiceWorker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OidcServiceWorker.d.ts","sourceRoot":"","sources":["../src/OidcServiceWorker.ts"],"names":[],"mappings":""}
|