@axa-fr/oidc-client 7.7.3 → 7.9.0-alpha.1110
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 +12 -0
- package/dist/fetch.d.ts +3 -0
- package/dist/index.js +724 -705
- package/dist/index.umd.cjs +2 -2
- package/dist/initWorker.d.ts +1 -6
- package/dist/initWorkerOption.d.ts +7 -0
- package/dist/oidcClient.d.ts +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/fetch.ts +36 -0
- package/src/iniWorker.spec.ts +1 -1
- package/src/initWorker.ts +16 -140
- package/src/initWorkerOption.ts +133 -0
- package/src/login.ts +2 -2
- package/src/logout.ts +1 -1
- package/src/oidc.ts +9 -7
- package/src/oidcClient.ts +5 -0
- package/src/renewTokens.ts +1 -1
- package/src/types.ts +3 -0
- package/src/user.ts +2 -1
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -119,6 +119,9 @@ export const configuration = {
|
|
|
119
119
|
const href = window.location.href;
|
|
120
120
|
const oidcClient = OidcClient.getOrCreate()(configuration);
|
|
121
121
|
|
|
122
|
+
// Use the fetch bellow to inject access_token and DPOP tokens automatically
|
|
123
|
+
const oidcFetch = oidcClient.fetchWithTokens(fetch);
|
|
124
|
+
|
|
122
125
|
// You can inject you own fetch (default Fetch Interface) function and location object (respecting IOidcLocation interface)
|
|
123
126
|
// import {OidcLocation} from '@axa-fr/oidc-client'
|
|
124
127
|
// const oidcClient = OidcClient.getOrCreate(() => fetch, new OidcLocation())(configuration);
|
|
@@ -190,7 +193,9 @@ const configuration = {
|
|
|
190
193
|
},
|
|
191
194
|
refresh_time_before_tokens_expiration_in_second: Number, // default is 120 seconds
|
|
192
195
|
service_worker_relative_url: String,
|
|
196
|
+
service_worker_keep_alive_path: String, // default is "/"
|
|
193
197
|
service_worker_only: Boolean, // default false
|
|
198
|
+
service_worker_activate: () => boolean, // you can take the control of the service worker default activation which use user agent string
|
|
194
199
|
service_worker_update_require_callback: (registration:any, stopKeepAlive:Function) => Promise<void>, // callback called when service worker need to be updated, you can take the control of the update process
|
|
195
200
|
extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that is sent to the OIDC server (more info: https://github.com/openid/AppAuth-JS)
|
|
196
201
|
token_request_extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that is sent to the OIDC server during token request (more info: https://github.com/openid/AppAuth-JS)
|
|
@@ -319,6 +324,13 @@ export class OidcClient {
|
|
|
319
324
|
*/
|
|
320
325
|
async getValidTokenAsync(waitMs = 200, numberWait = 50): Promise<ValidToken>;
|
|
321
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Retrieves a new fetch function that inject bearer tokens (also DPOP tokens).
|
|
329
|
+
* @param fetch The current fetch function to use
|
|
330
|
+
* @returns Fetch A new fectch function that inject bearer tokens (also DPOP tokens).
|
|
331
|
+
*/
|
|
332
|
+
fetchWithTokens(fetch: Fetch): Fetch;
|
|
333
|
+
|
|
322
334
|
/**
|
|
323
335
|
* Retrieves OIDC user information.
|
|
324
336
|
* @param noCache Indicates whether user information should be retrieved bypassing the cache.
|
package/dist/fetch.d.ts
ADDED