@axa-fr/oidc-client 6.26.6 → 7.0.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 +222 -92
- package/dist/cache.d.ts +0 -1
- package/dist/checkSession.d.ts +0 -1
- package/dist/checkSessionIFrame.d.ts +0 -1
- package/dist/crypto.d.ts +0 -1
- package/dist/events.d.ts +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/iniWorker.spec.d.ts.map +1 -1
- package/dist/initSession.d.ts +0 -1
- package/dist/initWorker.d.ts +0 -1
- package/dist/login.d.ts +0 -1
- package/dist/logout.d.ts +0 -1
- package/dist/logout.spec.d.ts.map +1 -1
- package/dist/oidc.d.ts +0 -1
- package/dist/{vanillaOidc.d.ts → oidcClient.d.ts} +3 -4
- package/dist/parseTokens.d.ts +0 -1
- package/dist/parseTokens.spec.d.ts.map +1 -1
- package/dist/renewTokens.d.ts +0 -1
- package/dist/requests.d.ts +0 -1
- package/dist/requests.spec.d.ts.map +1 -1
- package/dist/route-utils.d.ts +0 -1
- package/dist/route-utils.spec.d.ts.map +1 -1
- package/dist/silentLogin.d.ts +0 -1
- package/dist/timer.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/user.d.ts +0 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/{vanillaOidc.ts → oidcClient.ts} +5 -5
- package/dist/cache.d.ts.map +0 -1
- package/dist/checkSession.d.ts.map +0 -1
- package/dist/checkSessionIFrame.d.ts.map +0 -1
- package/dist/crypto.d.ts.map +0 -1
- package/dist/events.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/initSession.d.ts.map +0 -1
- package/dist/initWorker.d.ts.map +0 -1
- package/dist/login.d.ts.map +0 -1
- package/dist/logout.d.ts.map +0 -1
- package/dist/oidc.d.ts.map +0 -1
- package/dist/parseTokens.d.ts.map +0 -1
- package/dist/renewTokens.d.ts.map +0 -1
- package/dist/requests.d.ts.map +0 -1
- package/dist/route-utils.d.ts.map +0 -1
- package/dist/silentLogin.d.ts.map +0 -1
- package/dist/timer.d.ts.map +0 -1
- package/dist/user.d.ts.map +0 -1
- package/dist/vanillaOidc.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @axa-fr/
|
|
1
|
+
# @axa-fr/oidc-client
|
|
2
2
|
|
|
3
3
|
[](https://github.com/AxaGuilDEv/react-oidc/actions/workflows/npm-publish.yml)
|
|
4
4
|
[](https://sonarcloud.io/dashboard?id=AxaGuilDEv_react-oidc) [](https://sonarcloud.io/component_measures?id=AxaGuilDEv_react-oidc&metric=reliability_rating) [](https://sonarcloud.io/component_measures?id=AxaGuilDEv_react-oidc&metric=security_rating) [](https://sonarcloud.io/component_measures?id=AxaGuilDEv_react-oidc&metric=Coverage) [](https://twitter.com/intent/follow?screen_name=GuildDEvOpen)
|
|
@@ -16,23 +16,21 @@ Try the demo at https://icy-glacier-004ab4303.2.azurestaticapps.net/
|
|
|
16
16
|
|
|
17
17
|
## About
|
|
18
18
|
|
|
19
|
-
@axa-fr/
|
|
20
|
-
|
|
21
|
-
It is a real alternative to existing oidc-client libraries.
|
|
19
|
+
@axa-fr/oidc-client is:
|
|
22
20
|
|
|
23
21
|
- **Secure** :
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **Lightweight**
|
|
27
|
-
- **Simple**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- **No cookies problem** : You can disable silent signin (that internally use an iframe). For your information, your OIDC server should be in the same domain of your website in order to be able to send OIDC server cookies from your website via an internal IFRAME, else, you may encounter COOKIES problem.
|
|
22
|
+
- With the use of Service Worker, your tokens (refresh_token and access_token) are not accessible to the JavaScript client code (big protection against XSS attacks)
|
|
23
|
+
- OIDC using client side Code Credential Grant with pkce only
|
|
24
|
+
- **Lightweight** : Unpacked Size on npm is **274 kB**
|
|
25
|
+
- **Simple**
|
|
26
|
+
- refresh_token and access_token are auto refreshed in background
|
|
27
|
+
- with the use of the Service Worker, you do not need to inject the access_token in every fetch, you have only to configure OidcTrustedDomains.js file
|
|
31
28
|
- **Multiple Authentication** :
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
- You can authenticate many times to the same provider with different scope (for example you can acquire a new 'payment' scope for a payment)
|
|
30
|
+
- You can authenticate to multiple different providers inside the same SPA (single page application) website
|
|
34
31
|
- **Flexible** :
|
|
35
|
-
|
|
32
|
+
- Work with Service Worker (more secure) and without for older browser (less secure).
|
|
33
|
+
- You can disable Service Worker if you want (but less secure) and just use SessionStorage or LocalStorage mode.
|
|
36
34
|
|
|
37
35
|

|
|
38
36
|
|
|
@@ -61,64 +59,75 @@ The only file you should edit is "OidcTrustedDomains.js".
|
|
|
61
59
|
|
|
62
60
|
// Domains used by OIDC server must be also declared here
|
|
63
61
|
const trustedDomains = {
|
|
64
|
-
default:
|
|
62
|
+
default: {
|
|
63
|
+
oidcDomains :["https://demo.duendesoftware.com"],
|
|
64
|
+
accessTokenDomains : ["https://www.myapi.com/users"]
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Service worker will continue to give access token to the JavaScript client
|
|
69
|
+
// Ideal to hide refresh token from client JavaScript, but to retrieve access_token for some
|
|
70
|
+
// scenarios which require it. For example, to send it via websocket connection.
|
|
71
|
+
trustedDomains.config_show_access_token = {
|
|
72
|
+
oidcDomains :["https://demo.duendesoftware.com"],
|
|
73
|
+
accessTokenDomains : ["https://www.myapi.com/users"],
|
|
74
|
+
showAccessToken: true
|
|
65
75
|
};
|
|
66
76
|
```
|
|
67
77
|
|
|
68
78
|
The code of the demo :
|
|
69
79
|
|
|
70
80
|
```js
|
|
71
|
-
import {
|
|
81
|
+
import {OidcClient} from '@axa-fr/oidc-client'
|
|
72
82
|
|
|
73
83
|
export const configuration = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
client_id: 'interactive.public.short',
|
|
85
|
+
redirect_uri: window.location.origin + '/#/authentication/callback',
|
|
86
|
+
silent_redirect_uri: window.location.origin + '/#/authentication/silent-callback',
|
|
87
|
+
scope: 'openid profile email api offline_access',
|
|
88
|
+
authority: 'https://demo.duendesoftware.com',
|
|
89
|
+
service_worker_relative_url: '/OidcServiceWorker.js',
|
|
90
|
+
service_worker_only: false,
|
|
81
91
|
};
|
|
82
92
|
|
|
83
93
|
const href = window.location.href;
|
|
84
|
-
const
|
|
94
|
+
const oidcClient = OidcClient.getOrCreate(() => fetch)(configuration);
|
|
85
95
|
|
|
86
96
|
console.log(href);
|
|
87
97
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
oidcClient.tryKeepExistingSessionAsync().then(() => {
|
|
99
|
+
if (href.includes(configuration.redirect_uri)) {
|
|
100
|
+
oidcClient.loginCallbackAsync().then(() => {
|
|
101
|
+
window.location.href = "/";
|
|
102
|
+
});
|
|
103
|
+
document.body.innerHTML = `<div>
|
|
94
104
|
<h1>@axa-fr/oidc-client demo</h1>
|
|
95
105
|
<h2>Loading</h2>
|
|
96
106
|
</div>`;
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
return
|
|
108
|
+
}
|
|
99
109
|
|
|
100
|
-
|
|
110
|
+
let tokens = oidcClient.tokens;
|
|
101
111
|
|
|
102
|
-
|
|
112
|
+
if (tokens) {
|
|
103
113
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
window.logout = () => oidcClient.logoutAsync();
|
|
116
|
+
document.body.innerHTML = `<div>
|
|
107
117
|
<h1>@axa-fr/oidc-client demo</h1>
|
|
108
118
|
<button onclick="window.logout()">Logout</button>
|
|
109
119
|
<h2>Authenticated</h2>
|
|
110
|
-
<pre>${JSON.stringify(tokens,null,'\t')}</pre>
|
|
120
|
+
<pre>${JSON.stringify(tokens, null, '\t')}</pre>
|
|
111
121
|
</div>`
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
document.body.innerHTML = `<div>
|
|
122
|
+
|
|
123
|
+
} else {
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
window.login = () => oidcClient.loginAsync("/");
|
|
126
|
+
document.body.innerHTML = `<div>
|
|
118
127
|
<h1>@axa-fr/oidc-client demo</h1>
|
|
119
128
|
<button onclick="window.login()">Login</button>
|
|
120
129
|
</div>`
|
|
121
|
-
|
|
130
|
+
}
|
|
122
131
|
})
|
|
123
132
|
|
|
124
133
|
|
|
@@ -127,50 +136,178 @@ vanillaOidc.tryKeepExistingSessionAsync().then(() => {
|
|
|
127
136
|
## Configuration
|
|
128
137
|
|
|
129
138
|
```javascript
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
authority_time_cache_wellknowurl_in_second: 60 * 60, // Time to cache in
|
|
157
|
-
authority_timeout_wellknowurl_in_millisecond: 10000, // Timeout in
|
|
158
|
-
monitor_session:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
|
|
140
|
+
const configuration = {
|
|
141
|
+
client_id: String.isRequired, // oidc client id
|
|
142
|
+
redirect_uri: String.isRequired, // oidc redirect url
|
|
143
|
+
silent_redirect_uri: String, // Optional activate silent-signin that use cookies between OIDC server and client javascript to restore sessions
|
|
144
|
+
silent_login_uri: String, // Optional, route that triggers the signin
|
|
145
|
+
silent_login_timeout: Number, // Optional, default is 12000 milliseconds
|
|
146
|
+
scope: String.isRequired, // oidc scope (you need to set "offline_access")
|
|
147
|
+
authority: String.isRequired,
|
|
148
|
+
storage: Storage, // Default sessionStorage, you can set localStorage, but it is less secure against XSS attacks
|
|
149
|
+
authority_configuration: {
|
|
150
|
+
// Optional for providers that do not implement OIDC server auto-discovery via a .wellknown URL
|
|
151
|
+
authorization_endpoint: String,
|
|
152
|
+
token_endpoint: String,
|
|
153
|
+
userinfo_endpoint: String,
|
|
154
|
+
end_session_endpoint: String,
|
|
155
|
+
revocation_endpoint: String,
|
|
156
|
+
check_session_iframe: String,
|
|
157
|
+
issuer: String,
|
|
158
|
+
},
|
|
159
|
+
refresh_time_before_tokens_expiration_in_second: Number, // default is 120 seconds
|
|
160
|
+
service_worker_relative_url: String,
|
|
161
|
+
service_worker_only: Boolean, // default false
|
|
162
|
+
service_worker_convert_all_requests_to_cors: Boolean, // force all requests that service worker upgrades to have 'cors' mode. This allows setting an authentication token on requests initiated by HTML parsing (e.g., img tags, download links, etc.).
|
|
163
|
+
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)
|
|
164
|
+
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)
|
|
165
|
+
authority_time_cache_wellknowurl_in_second: 60 * 60, // Time to cache in seconds of the openid well-known URL, default is 1 hour
|
|
166
|
+
authority_timeout_wellknowurl_in_millisecond: 10000, // Timeout in milliseconds of the openid well-known URL, default is 10 seconds, then an error is thrown
|
|
167
|
+
monitor_session: Boolean, // Add OpenID monitor session, default is false (more information https://openid.net/specs/openid-connect-session-1_0.html), if you need to set it to true consider https://infi.nl/nieuws/spa-necromancy/
|
|
168
|
+
token_renew_mode: String, // Optional, update tokens based on the selected token(s) lifetime: "access_token_or_id_token_invalid" (default), "access_token_invalid", "id_token_invalid"
|
|
169
|
+
logout_tokens_to_invalidate: Array<string>, // Optional tokens to invalidate during logout, default: ['access_token', 'refresh_token']
|
|
170
|
+
};
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## API
|
|
174
|
+
|
|
175
|
+
```javascript
|
|
176
|
+
/**
|
|
177
|
+
* OidcClient is a class that acts as a wrapper around the `Oidc` object. It provides methods to handle event subscriptions, logins, logouts, token renewals, user information, etc.
|
|
178
|
+
*/
|
|
179
|
+
export class OidcClient {
|
|
180
|
+
/**
|
|
181
|
+
* Creates an instance of OidcClient using a provided `Oidc` object.
|
|
182
|
+
* @param oidc The instance of the underlying Oidc object to use.
|
|
183
|
+
*/
|
|
184
|
+
constructor(oidc: Oidc);
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Subscribes a function to events emitted by the underlying Oidc object.
|
|
188
|
+
* @param func The function to be called when an event is emitted.
|
|
189
|
+
* @returns A string that identifies the subscription and can be used to unsubscribe later.
|
|
190
|
+
*/
|
|
191
|
+
subscribeEvents(func: EventSubscriber): string;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Removes a subscription to a specified event.
|
|
195
|
+
* @param id The identifier of the subscription to remove, obtained during the initial subscription.
|
|
196
|
+
*/
|
|
197
|
+
removeEventSubscription(id: string): void;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Publishes an event with the specified name and associated data.
|
|
201
|
+
* @param eventName The name of the event to publish.
|
|
202
|
+
* @param data The data associated with the event.
|
|
203
|
+
*/
|
|
204
|
+
publishEvent(eventName: string, data: any): void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Creates a new instance of OidcClient using a fetch retrieval function `getFetch`, with a given OIDC configuration and an optional name.
|
|
208
|
+
* @param getFetch The function to retrieve the `Fetch` object.
|
|
209
|
+
* @param configuration The OIDC configuration to use for creating the OidcClient instance.
|
|
210
|
+
* @param name The optional name for the created OidcClient instance.
|
|
211
|
+
* @returns A new instance of OidcClient with the specified configuration.
|
|
212
|
+
*/
|
|
213
|
+
static getOrCreate(getFetch: () => Fetch)(configuration: OidcConfiguration, name?: string): OidcClient;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Retrieves an existing OidcClient instance with the specified name, or creates a new instance if it does not exist.
|
|
217
|
+
* @param name The name of the OidcClient instance to retrieve.
|
|
218
|
+
* @returns The existing OidcClient instance or a new instance with the specified name.
|
|
219
|
+
*/
|
|
220
|
+
static get(name?: string): OidcClient;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The names of the events supported by the Oidc class.
|
|
224
|
+
*/
|
|
225
|
+
static eventNames: Oidc.eventNames;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Attempts to keep the existing user session by calling the function of the underlying Oidc object.
|
|
229
|
+
* @returns A promise resolved with `true` if the user session was kept, otherwise `false`.
|
|
230
|
+
*/
|
|
231
|
+
tryKeepExistingSessionAsync(): Promise<boolean>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Starts the OIDC login process with specified options.
|
|
235
|
+
* @param callbackPath The callback path for authentication.
|
|
236
|
+
* @param extras Additional parameters to send to the OIDC server during the login request.
|
|
237
|
+
* @param isSilentSignin Indicates if the login is silent.
|
|
238
|
+
* @param scope The OIDC scope for the login request.
|
|
239
|
+
* @param silentLoginOnly Indicates if only silent login is allowed.
|
|
240
|
+
* @returns A promise resolved with the login information, or rejected with an error.
|
|
241
|
+
*/
|
|
242
|
+
loginAsync(callbackPath?: string, extras?: StringMap, isSilentSignin?: boolean, scope?: string, silentLoginOnly?: boolean): Promise<unknown>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Starts the OIDC logout process with specified options.
|
|
246
|
+
* @param callbackPathOrUrl The callback path or URL to use after logout.
|
|
247
|
+
* @param extras Additional parameters to send to the OIDC server during the logout request.
|
|
248
|
+
* @returns A promise resolved when the logout is completed.
|
|
249
|
+
*/
|
|
250
|
+
logoutAsync(callbackPathOrUrl?: string | null | undefined, extras?: StringMap): Promise<void>;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Performs the silent login process and retrieves user information.
|
|
254
|
+
* @returns A promise resolved when the silent login process is completed.
|
|
255
|
+
*/
|
|
256
|
+
silentLoginCallbackAsync(): Promise<void>;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Renews the user's OIDC tokens.
|
|
260
|
+
* @param extras Additional parameters to send to the OIDC server during the token renewal request.
|
|
261
|
+
* @returns A promise resolved when the token renewal is completed.
|
|
262
|
+
*/
|
|
263
|
+
renewTokensAsync(extras?: StringMap): Promise<void>;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Performs the callback process after a successful login and automatically renews tokens.
|
|
267
|
+
* @returns A promise resolved with the callback information, or rejected with an error.
|
|
268
|
+
*/
|
|
269
|
+
loginCallbackAsync(): Promise<LoginCallback>;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Retrieves the current OIDC tokens for the user.
|
|
273
|
+
*/
|
|
274
|
+
get tokens(): Tokens;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Retrieves the current OIDC configuration used by the OidcClient instance.
|
|
278
|
+
*/
|
|
279
|
+
get configuration(): OidcConfiguration;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Retrieves the valid OIDC token for the user.
|
|
283
|
+
* @param waitMs The maximum wait time in milliseconds to obtain a valid token.
|
|
284
|
+
* @param numberWait The number of attempts to obtain a valid token.
|
|
285
|
+
* @returns A promise resolved with the valid token, or rejected with an error.
|
|
286
|
+
*/
|
|
287
|
+
async getValidTokenAsync(waitMs = 200, numberWait = 50): Promise<ValidToken>;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Retrieves OIDC user information.
|
|
291
|
+
* @param noCache Indicates whether user information should be retrieved bypassing the cache.
|
|
292
|
+
* @returns A promise resolved with the user information, or rejected with an error.
|
|
293
|
+
*/
|
|
294
|
+
async userInfoAsync<T extends OidcUserInfo = OidcUserInfo>(noCache = false): Promise<T>;
|
|
295
|
+
}
|
|
296
|
+
|
|
164
297
|
```
|
|
165
298
|
|
|
166
299
|
## Run The Demo
|
|
167
300
|
|
|
168
301
|
```sh
|
|
169
|
-
git clone https://github.com/
|
|
170
|
-
cd
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
302
|
+
git clone https://github.com/AxaFrance/oidc-client.git
|
|
303
|
+
cd oidc-client
|
|
304
|
+
|
|
305
|
+
# oidc client demo
|
|
306
|
+
cd /examples/oidc-client-demo
|
|
307
|
+
pnpm install
|
|
308
|
+
pnpm start
|
|
309
|
+
# then navigate to http://localhost:5174
|
|
310
|
+
|
|
174
311
|
```
|
|
175
312
|
|
|
176
313
|
## How It Works
|
|
@@ -185,7 +322,7 @@ More information about OIDC
|
|
|
185
322
|
|
|
186
323
|
## Hash route
|
|
187
324
|
|
|
188
|
-
|
|
325
|
+
`@axa-fr/oidc-client` work also with hash route.
|
|
189
326
|
|
|
190
327
|
```javascript
|
|
191
328
|
export const configurationIdentityServerWithHash = {
|
|
@@ -200,10 +337,3 @@ export const configurationIdentityServerWithHash = {
|
|
|
200
337
|
service_worker_only: false,
|
|
201
338
|
};
|
|
202
339
|
```
|
|
203
|
-
|
|
204
|
-
## Service Worker Support
|
|
205
|
-
|
|
206
|
-
- Firefox : tested on Firefox 98.0.2
|
|
207
|
-
- Chrome/Edge : tested on version upper to 90
|
|
208
|
-
- Opera : tested on version upper to 80
|
|
209
|
-
- Safari : tested on Safari/605.1.15
|
package/dist/cache.d.ts
CHANGED
package/dist/checkSession.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { CheckSessionIFrame } from './checkSessionIFrame.js';
|
|
2
2
|
import { OidcConfiguration } from './types.js';
|
|
3
3
|
export declare const startCheckSessionAsync: (oidc: any, oidcDatabase: any, configuration: OidcConfiguration) => (checkSessionIFrameUri: any, clientId: any, sessionState: any, isSilentSignin?: boolean) => Promise<CheckSessionIFrame>;
|
|
4
|
-
//# sourceMappingURL=checkSession.d.ts.map
|
package/dist/crypto.d.ts
CHANGED
package/dist/events.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ export { getFetchDefault } from './oidc.js';
|
|
|
2
2
|
export { TokenRenewMode } from './parseTokens.js';
|
|
3
3
|
export { getParseQueryStringFromLocation, getPath } from './route-utils';
|
|
4
4
|
export type { AuthorityConfiguration, Fetch, OidcConfiguration, StringMap, } from './types.js';
|
|
5
|
-
export { type OidcUserInfo,
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
5
|
+
export { type OidcUserInfo, OidcClient } from './oidcClient.js';
|
package/dist/index.js
CHANGED
|
@@ -1228,8 +1228,8 @@ const R = class R {
|
|
|
1228
1228
|
R.getOrCreate = (e) => (t, s = "default") => new R(N.getOrCreate(e)(t, s)), R.eventNames = N.eventNames;
|
|
1229
1229
|
let se = R;
|
|
1230
1230
|
export {
|
|
1231
|
+
se as OidcClient,
|
|
1231
1232
|
j as TokenRenewMode,
|
|
1232
|
-
se as VanillaOidc,
|
|
1233
1233
|
qe as getFetchDefault,
|
|
1234
1234
|
B as getParseQueryStringFromLocation,
|
|
1235
1235
|
Xe as getPath
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(T,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(T=typeof globalThis<"u"?globalThis:T||self,j(T["oidc-client"]={}))})(this,function(T){"use strict";const x=console;class fe{constructor(e,t,s,i=2e3,o=!0){this._callback=e,this._client_id=t,this._url=s,this._interval=i||2e3,this._stopOnError=o;const r=s.indexOf("/",s.indexOf("//")+2);this._frame_origin=s.substr(0,r),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=s}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),this._boundMessageEvent=this._message.bind(this),window.addEventListener("message",this._boundMessageEvent,!1)})}_message(e){e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&(e.data==="error"?(x.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):e.data==="changed"?(x.debug(e),x.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):x.debug("CheckSessionIFrame: "+e.data+" message from check session op iframe"))}start(e){x.debug("CheckSessionIFrame.start :"+e),this.stop();const t=()=>{this._frame.contentWindow.postMessage(this._client_id+" "+e,this._frame_origin)};t(),this._timer=window.setInterval(t,this._interval)}stop(){this._timer&&(x.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)}}const m={service_worker_not_supported_by_browser:"service_worker_not_supported_by_browser",token_aquired:"token_aquired",logout_from_another_tab:"logout_from_another_tab",logout_from_same_tab:"logout_from_same_tab",token_renewed:"token_renewed",token_timer:"token_timer",loginAsync_begin:"loginAsync_begin",loginAsync_error:"loginAsync_error",loginCallbackAsync_begin:"loginCallbackAsync_begin",loginCallbackAsync_end:"loginCallbackAsync_end",loginCallbackAsync_error:"loginCallbackAsync_error",refreshTokensAsync_begin:"refreshTokensAsync_begin",refreshTokensAsync:"refreshTokensAsync",refreshTokensAsync_end:"refreshTokensAsync_end",refreshTokensAsync_error:"refreshTokensAsync_error",refreshTokensAsync_silent_error:"refreshTokensAsync_silent_error",tryKeepExistingSessionAsync_begin:"tryKeepExistingSessionAsync_begin",tryKeepExistingSessionAsync_end:"tryKeepExistingSessionAsync_end",tryKeepExistingSessionAsync_error:"tryKeepExistingSessionAsync_error",silentLoginAsync_begin:"silentLoginAsync_begin",silentLoginAsync:"silentLoginAsync",silentLoginAsync_end:"silentLoginAsync_end",silentLoginAsync_error:"silentLoginAsync_error",syncTokensAsync_begin:"syncTokensAsync_begin",syncTokensAsync_end:"syncTokensAsync_end",syncTokensAsync_error:"syncTokensAsync_error"},I=(n,e=sessionStorage)=>{const t=k=>(e[`oidc.${n}`]=JSON.stringify({tokens:null,status:k}),Promise.resolve()),s=async()=>{if(!e[`oidc.${n}`])return e[`oidc.${n}`]=JSON.stringify({tokens:null,status:null}),{tokens:null,status:null};const k=JSON.parse(e[`oidc.${n}`]);return Promise.resolve({tokens:k.tokens,status:k.status})},i=k=>{e[`oidc.${n}`]=JSON.stringify({tokens:k})},o=async k=>{e[`oidc.session_state.${n}`]=k},r=async()=>e[`oidc.session_state.${n}`],l=k=>{localStorage[`oidc.nonce.${n}`]=k.nonce},c=async()=>({nonce:localStorage[`oidc.nonce.${n}`]}),d=()=>e[`oidc.${n}`]?JSON.stringify({tokens:JSON.parse(e[`oidc.${n}`]).tokens}):null;let a=null;return{clearAsync:t,initAsync:s,setTokens:i,getTokens:d,setSessionStateAsync:o,getSessionStateAsync:r,setNonceAsync:l,getNonceAsync:c,setLoginParams:(k,p)=>{a=p,e[`oidc.login.${k}`]=JSON.stringify(p)},getLoginParams:k=>{const p=e[`oidc.login.${k}`];return a||(a=JSON.parse(p)),a},getStateAsync:async()=>e[`oidc.state.${n}`],setStateAsync:async k=>{e[`oidc.state.${n}`]=k},getCodeVerifierAsync:async()=>e[`oidc.code_verifier.${n}`],setCodeVerifierAsync:async k=>{e[`oidc.code_verifier.${n}`]=k}}},ye=n=>decodeURIComponent(Array.prototype.map.call(atob(n),e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),ge=n=>JSON.parse(ye(n.split(".")[1].replace("-","+").replace("_","/"))),ne=n=>{try{return n&&ke(n,".")===2?ge(n):null}catch(e){console.warn(e)}return null},ke=(n,e)=>n.split(e).length-1,q={access_token_or_id_token_invalid:"access_token_or_id_token_invalid",access_token_invalid:"access_token_invalid",id_token_invalid:"id_token_invalid"},te=(n,e=null,t)=>{if(!n)return null;let s;if(!n.issuedAt){const d=new Date().getTime()/1e3;n.issuedAt=d}n.accessTokenPayload!==void 0?s=n.accessTokenPayload:s=ne(n.accessToken);const i=n.idTokenPayload?n.idTokenPayload:ne(n.idToken),o=i&&i.exp?i.exp:Number.MAX_VALUE,r=s&&s.exp?s.exp:n.issuedAt+n.expiresIn;let l;t===q.access_token_invalid?l=r:t===q.id_token_invalid?l=o:l=o<r?o:r;const c={...n,idTokenPayload:i,accessTokenPayload:s,expiresAt:l};if(e!=null&&"refreshToken"in e&&!("refreshToken"in n)){const d=e.refreshToken;return{...c,refreshToken:d}}return c},J=(n,e,t)=>{if(!n)return null;if(!n.issued_at){const i=new Date().getTime()/1e3;n.issued_at=i}const s={accessToken:n.access_token,expiresIn:n.expires_in,idToken:n.id_token,scope:n.scope,tokenType:n.token_type,issuedAt:n.issued_at};return"refresh_token"in n&&(s.refreshToken=n.refresh_token),n.accessTokenPayload!==void 0&&(s.accessTokenPayload=n.accessTokenPayload),n.idTokenPayload!==void 0&&(s.idTokenPayload=n.idTokenPayload),te(s,e,t)},D=(n,e)=>{const t=new Date().getTime()/1e3;return Math.round(e-n-t)},H=n=>n?D(0,n.expiresAt)>0:!1,me=async(n,e=200,t=50)=>{let s=t;if(!n.tokens)return null;for(;!H(n.tokens)&&s>0;)await F(e),s=s-1;return{isTokensValid:H(n.tokens),tokens:n.tokens,numberWaited:s-t}},se=(n,e,t)=>{if(n.idTokenPayload){const s=n.idTokenPayload;if(t.issuer!==s.iss)return{isValid:!1,reason:"Issuer does not match"};const i=new Date().getTime()/1e3;if(s.exp&&s.exp<i)return{isValid:!1,reason:"Token expired"};const o=60*60*24*7;if(s.iat&&s.iat+o<i)return{isValid:!1,reason:"Token is used from too long time"};if(s.nonce&&s.nonce!==e)return{isValid:!1,reason:"Nonce does not match"}}return{isValid:!0,reason:""}},V=function(){const n=function(){let c,d;const a=(function(){const y={},u={setTimeout:function(_,g,k){y[g]=setTimeout(function(){_.postMessage(g),y[g]=null},k)},setInterval:function(_,g,k){y[g]=setInterval(function(){_.postMessage(g)},k)},clearTimeout:function(_,g){clearTimeout(y[g]),y[g]=null},clearInterval:function(_,g){clearInterval(y[g]),y[g]=null}};function f(_,g){const k=g.data[0],p=g.data[1],v=g.data[2];u[k]&&u[k](_,p,v)}this.onmessage=function(_){f(self,_)},this.onconnect=function(_){const g=_.ports[0];g.onmessage=function(k){f(g,k)}}}).toString();try{const y=new Blob(["(",a,")()"],{type:"application/javascript"});d=URL.createObjectURL(y)}catch{return null}const h=typeof process>"u";try{if(SharedWorker)return c=new SharedWorker(d),c.port}catch{h&&console.warn("SharedWorker not available")}try{if(Worker)return c=new Worker(d),c}catch{h&&console.warn("Worker not available")}return null}();if(!n){const c=typeof window>"u"?global:window;return{setTimeout:setTimeout.bind(c),clearTimeout:clearTimeout.bind(c),setInterval:setInterval.bind(c),clearInterval:clearInterval.bind(c)}}const e=function(){let c=0;return function(){return c++,c}}(),t={},s={};n.onmessage=function(c){const d=c.data,a=t[d];if(a){a(),t[d]=null;return}const h=s[d];h&&h()};function i(c,d){const a=e();return n.postMessage(["setTimeout",a,d]),t[a]=c,a}function o(c){n.postMessage(["clearTimeout",c]),t[c]=null}function r(c,d){const a=e();return n.postMessage(["setInterval",a,d]),s[a]=c,a}function l(c){n.postMessage(["clearInterval",c]),s[c]=null}return{setTimeout:i,clearTimeout:o,setInterval:r,clearInterval:l}}(),oe=n=>{const e=n.appVersion,t=n.userAgent,s="-";let i=s;const o=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Chrome OS",r:/CrOS/},{s:"Linux",r:/(Linux|X11(?!.*CrOS))/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(const l in o){const c=o[l];if(c.r.test(t)){i=c.s;break}}let r=s;switch(/Windows/.test(i)&&(r=/Windows (.*)/.exec(i)[1],i="Windows"),i){case"Mac OS":case"Mac OS X":case"Android":r=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(t)[1];break;case"iOS":{const l=/OS (\d+)_(\d+)_?(\d+)?/.exec(e);r=l[1]+"."+l[2]+"."+(parseInt(l[3])|0);break}}return{os:i,osVersion:r}};function we(){const n=navigator.userAgent;let e,t=n.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(t[1]))return e=/\brv[ :]+(\d+)/g.exec(n)||[],{name:"ie",version:e[1]||""};if(t[1]==="Chrome"&&(e=n.match(/\bOPR|Edge\/(\d+)/),e!=null)){let s=e[1];if(!s){const i=n.split(e[0]+"/");i.length>1&&(s=i[1])}return{name:"opera",version:s}}return t=t[2]?[t[1],t[2]]:[navigator.appName,navigator.appVersion,"-?"],(e=n.match(/version\/(\d+)/i))!=null&&t.splice(1,1,e[1]),{name:t[0].toLowerCase(),version:t[1]}}let ie=null;const F=n=>new Promise(e=>V.setTimeout(e,n)),re=()=>{try{const e=oe(navigator).os==="Android"?240:150;fetch(`/OidcKeepAliveServiceWorker.json?minSleepSeconds=${e}`).catch(s=>{console.log(s)}),F(e*1e3).then(re)}catch(n){console.log(n)}},pe=()=>fetch("/OidcKeepAliveServiceWorker.json",{headers:{"oidc-vanilla":"true"}}).then(n=>n.statusText==="oidc-service-worker").catch(n=>{console.log(n)}),Ae=n=>!!(n.os==="iOS"&&n.osVersion.startsWith("12")||n.os==="Mac OS X"&&n.osVersion.startsWith("10_15_6")),b=n=>e=>new Promise(function(t,s){const i=new MessageChannel;i.port1.onmessage=function(o){o.data&&o.data.error?s(o.data.error):t(o.data)},n.active.postMessage(e,[i.port2])}),O=async(n,e)=>{if(typeof window>"u"||typeof navigator>"u"||!navigator.serviceWorker||!n)return null;const{name:t,version:s}=we();if(t==="chrome"&&parseInt(s)<90||t==="opera"&&(!s||parseInt(s.split(".")[0])<80)||t==="ie")return null;const i=oe(navigator);if(Ae(i))return null;const o=await navigator.serviceWorker.register(n);try{await navigator.serviceWorker.ready}catch{return null}const r=async()=>await o.unregister();o.addEventListener("updatefound",()=>{const w=o.installing;w.addEventListener("statechange",()=>{switch(w.state){case"installed":navigator.serviceWorker.controller&&o.unregister().then(()=>{window.location.reload()});break}})});const l=async w=>b(o)({type:"clear",data:{status:w},configurationName:e}),c=async(w,A,S)=>{const N=await b(o)({type:"init",data:{oidcServerConfiguration:w,where:A,oidcConfiguration:{token_renew_mode:S.token_renew_mode,service_worker_convert_all_requests_to_cors:S.service_worker_convert_all_requests_to_cors}},configurationName:e});return{tokens:J(N.tokens,null,S.token_renew_mode),status:N.status}},d=()=>{ie==null&&(ie="not_null",re())},a=w=>b(o)({type:"setSessionState",data:{sessionState:w},configurationName:e}),h=async()=>(await b(o)({type:"getSessionState",data:null,configurationName:e})).sessionState,y=w=>(sessionStorage["oidc.nonce"]=w.nonce,b(o)({type:"setNonce",data:{nonce:w},configurationName:e})),u=async()=>{let A=(await b(o)({type:"getNonce",data:null,configurationName:e})).nonce;return A||(A=sessionStorage["oidc.nonce"],console.warn("nonce not found in service worker, using sessionStorage")),{nonce:A}};let f=null;return{clearAsync:l,initAsync:c,startKeepAliveServiceWorker:d,isServiceWorkerProxyActiveAsync:pe,setSessionStateAsync:a,getSessionStateAsync:h,setNonceAsync:y,getNonceAsync:u,unregisterAsync:r,setLoginParams:(w,A)=>{f=A,localStorage[`oidc.login.${w}`]=JSON.stringify(A)},getLoginParams:w=>{const A=localStorage[`oidc.login.${w}`];return f||(f=JSON.parse(A)),f},getStateAsync:async()=>{let A=(await b(o)({type:"getState",data:null,configurationName:e})).state;return A||(A=sessionStorage[`oidc.state.${e}`],console.warn("state not found in service worker, using sessionStorage")),A},setStateAsync:async w=>(sessionStorage[`oidc.state.${e}`]=w,b(o)({type:"setState",data:{state:w},configurationName:e})),getCodeVerifierAsync:async()=>{let A=(await b(o)({type:"getCodeVerifier",data:null,configurationName:e})).codeVerifier;return A||(A=sessionStorage[`oidc.code_verifier.${e}`],console.warn("codeVerifier not found in service worker, using sessionStorage")),A},setCodeVerifierAsync:async w=>(sessionStorage[`oidc.code_verifier.${e}`]=w,b(o)({type:"setCodeVerifier",data:{codeVerifier:w},configurationName:e}))}};async function ae(n,e,t=!1,s=null){const i=c=>{n.tokens=c},{tokens:o,status:r}=await n.synchroniseTokensAsync(e,0,t,s,i);if(await O(n.configuration.service_worker_relative_url,n.configurationName)||await I(n.configurationName,n.configuration.storage).setTokens(n.tokens),!n.tokens){await n.destroyAsync(r);return}return n.timeoutId&&(n.timeoutId=K(n,o.refreshToken,n.tokens.expiresAt,s)),n.tokens}const K=(n,e,t,s=null)=>{const i=n.configuration.refresh_time_before_tokens_expiration_in_second;return V.setTimeout(async()=>{const r={timeLeft:D(i,t)};n.publishEvent(W.eventNames.token_timer,r),await ae(n,e,!1,s)},1e3)},X=(n,e,t)=>(s=null,i=null,o=null)=>{if(!e.silent_redirect_uri||!e.silent_login_uri)return Promise.resolve(null);try{t(m.silentLoginAsync_begin,{});let r="";if(i&&(s==null&&(s={}),s.state=i),o&&(s==null&&(s={}),s.scope=o),s!=null)for(const[h,y]of Object.entries(s))r===""?r=`?${encodeURIComponent(h)}=${encodeURIComponent(y)}`:r+=`&${encodeURIComponent(h)}=${encodeURIComponent(y)}`;const l=e.silent_login_uri+r,c=l.indexOf("/",l.indexOf("//")+2),d=l.substr(0,c),a=document.createElement("iframe");return a.width="0px",a.height="0px",a.id=`${n}_oidc_iframe`,a.setAttribute("src",l),document.body.appendChild(a),new Promise((h,y)=>{try{let u=!1;window.onmessage=_=>{if(_.origin===d&&_.source===a.contentWindow){const g=`${n}_oidc_tokens:`,k=`${n}_oidc_error:`,p=_.data;if(p&&typeof p=="string"&&!u){if(p.startsWith(g)){const v=JSON.parse(_.data.replace(g,""));t(m.silentLoginAsync_end,{}),a.remove(),u=!0,h(v)}else if(p.startsWith(k)){const v=JSON.parse(_.data.replace(k,""));t(m.silentLoginAsync_error,v),a.remove(),u=!0,y(new Error("oidc_"+v.error))}}}};const f=e.silent_login_timeout;setTimeout(()=>{u||(t(m.silentLoginAsync_error,{reason:"timeout"}),a.remove(),u=!0,y(new Error("timeout")))},f)}catch(u){a.remove(),t(m.silentLoginAsync_error,u),y(u)}})}catch(r){throw t(m.silentLoginAsync_error,r),r}},Se=(n,e,t,s,i)=>(o=null,r=void 0)=>{o={...o};const l=(d,a,h)=>X(e,t,s.bind(i))(d,a,h);return(async()=>{i.timeoutId&&V.clearTimeout(i.timeoutId);let d;o&&"state"in o&&(d=o.state,delete o.state);try{const a=t.extras?{...t.extras,...o}:o,h=await l({...a,prompt:"none"},d,r);if(h)return i.tokens=h.tokens,s(m.token_aquired,{}),i.timeoutId=K(i,i.tokens.refreshToken,i.tokens.expiresAt,o),{}}catch(a){return a}})()},ve=(n,e,t)=>(s,i,o,r=!1)=>{const l=(c,d=void 0,a=void 0)=>X(n.configurationName,t,n.publishEvent.bind(n))(c,d,a);return new Promise((c,d)=>{if(t.silent_login_uri&&t.silent_redirect_uri&&t.monitor_session&&s&&o&&!r){const a=()=>{n.checkSessionIFrame.stop();const h=n.tokens;if(h===null)return;const y=h.idToken,u=h.idTokenPayload;return l({prompt:"none",id_token_hint:y,scope:t.scope||"openid"}).then(f=>{const _=f.tokens.idTokenPayload;if(u.sub===_.sub){const g=f.sessionState;n.checkSessionIFrame.start(f.sessionState),u.sid===_.sid?console.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",g):console.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",g)}else console.debug("SessionMonitor._callback: Different subject signed into OP:",_.sub)}).catch(async f=>{console.warn("SessionMonitor._callback: Silent login failed, logging out other tabs:",f);for(const[_,g]of Object.entries(e))await g.logoutOtherTabAsync(t.client_id,u.sub)})};n.checkSessionIFrame=new fe(a,i,s),n.checkSessionIFrame.load().then(()=>{n.checkSessionIFrame.start(o),c(n.checkSessionIFrame)}).catch(h=>{d(h)})}else c(null)})};for(var Te=Ie,E=[],ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",G=0,be=ce.length;G<be;++G)E[G]=ce[G];function Ee(n){return E[n>>18&63]+E[n>>12&63]+E[n>>6&63]+E[n&63]}function Pe(n,e,t){for(var s,i=[],o=e;o<t;o+=3)s=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(n[o+2]&255),i.push(Ee(s));return i.join("")}function Ie(n){for(var e,t=n.length,s=t%3,i=[],o=16383,r=0,l=t-s;r<l;r+=o)i.push(Pe(n,r,r+o>l?l:r+o));return s===1?(e=n[t-1],i.push(E[e>>2]+E[e<<4&63]+"==")):s===2&&(e=(n[t-2]<<8)+n[t-1],i.push(E[e>>10]+E[e>>4&63]+E[e<<2&63]+"=")),i.join("")}const le=()=>{const n=typeof window<"u"&&!!window.crypto,e=n&&!!window.crypto.subtle;return{hasCrypto:n,hasSubtleCrypto:e}},z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Oe=n=>{const e=[];for(let t=0;t<n.byteLength;t+=1){const s=n[t]%z.length;e.push(z[s])}return e.join("")},Ce=n=>Te(new Uint8Array(n)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),Y=n=>{const e=new Uint8Array(n),{hasCrypto:t}=le();if(t)window.crypto.getRandomValues(e);else for(let s=0;s<n;s+=1)e[s]=Math.random()*z.length|0;return Oe(e)};function Le(n){const e=new ArrayBuffer(n.length),t=new Uint8Array(e);for(let s=0;s<n.length;s++)t[s]=n.charCodeAt(s);return t}const Ne=n=>{if(n.length<43||n.length>128)return Promise.reject(new Error("Invalid code length."));const{hasSubtleCrypto:e}=le();return e?new Promise((t,s)=>{crypto.subtle.digest("SHA-256",Le(n)).then(i=>t(Ce(new Uint8Array(i))),i=>s(i))}):Promise.reject(new Error("window.crypto.subtle is unavailable."))},R={},We=(n,e=window.sessionStorage,t)=>{if(!R[n]&&e){const i=e.getItem(n);i&&(R[n]=JSON.parse(i))}const s=1e3*t;return R[n]&&R[n].timestamp+s>Date.now()?R[n].result:null},xe=(n,e,t=window.sessionStorage)=>{const s=Date.now();R[n]={result:e,timestamp:s},t&&t.setItem(n,JSON.stringify({result:e,timestamp:s}))},Fe=60*60,Re=n=>async(e,t=Fe,s=window.sessionStorage,i=1e4)=>{const o=`${e}/.well-known/openid-configuration`,r=`oidc.server:${e}`,l=We(r,s,t);if(l)return new Z(l);const c=await U(n)(o,{},i);if(c.status!==200)return null;const d=await c.json();return xe(r,d,s),new Z(d)},U=n=>async(e,t={},s=1e4,i=0)=>{let o;try{const r=new AbortController;setTimeout(()=>r.abort(),s),o=await n(e,{...t,signal:r.signal})}catch(r){if(r.name==="AbortError"||r.message==="Network request failed"){if(i<=1)return await U(n)(e,t,s,i+1);throw r}else throw console.error(r.message),r}return o},Q={refresh_token:"refresh_token",access_token:"access_token"},ue=n=>async(e,t,s=Q.refresh_token,i,o=1e4)=>{const r={token:t,token_type_hint:s,client_id:i},l=[];for(const a in r){const h=encodeURIComponent(a),y=encodeURIComponent(r[a]);l.push(`${h}=${y}`)}const c=l.join("&");return(await U(n)(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:c},o)).status!==200?{success:!1}:{success:!0}},$e=n=>async(e,t,s,i,o,r=1e4)=>{for(const[h,y]of Object.entries(s))t[h]===void 0&&(t[h]=y);const l=[];for(const h in t){const y=encodeURIComponent(h),u=encodeURIComponent(t[h]);l.push(`${y}=${u}`)}const c=l.join("&"),d=await U(n)(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:c},r);if(d.status!==200)return{success:!1,status:d.status};const a=await d.json();return{success:!0,data:J(a,i,o)}},Me=n=>async(e,t)=>{t=t?{...t}:{};const s=Y(128),i=await Ne(s);await n.setCodeVerifierAsync(s),await n.setStateAsync(t.state),t.code_challenge=i,t.code_challenge_method="S256";let o="";if(t)for(const[r,l]of Object.entries(t))o===""?o+="?":o+="&",o+=`${r}=${encodeURIComponent(l)}`;window.location.href=`${e}${o}`},De=n=>async(e,t,s,i=1e4)=>{t=t?{...t}:{},t.code_verifier=await n.getCodeVerifierAsync();const o=[];for(const d in t){const a=encodeURIComponent(d),h=encodeURIComponent(t[d]);o.push(`${a}=${h}`)}const r=o.join("&"),l=await U(fetch)(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:r},i);if(await Promise.all([n.setCodeVerifierAsync(null),n.setStateAsync(null)]),l.status!==200)return{success:!1,status:l.status};const c=await l.json();return{success:!0,data:{state:t.state,tokens:J(c,null,s)}}},de=n=>{const e=n.match(/^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);if(!e)throw new Error("Invalid URL");let t=e[6],s=e[7];if(s){const i=s.split("?");i.length===2&&(s=i[0],t=i[1])}return t.startsWith("?")&&(t=t.slice(1)),e&&{href:n,protocol:e[1],host:e[2],hostname:e[3],port:e[4],path:e[5],search:t,hash:s}},Ve=n=>{const e=de(n);let{path:t}=e;t.endsWith("/")&&(t=t.slice(0,-1));let{hash:s}=e;return s==="#_=_"&&(s=""),s&&(t+=s),t},B=n=>{const e=de(n),{search:t}=e;return Ke(t)},Ke=n=>{const e={};let t,s,i;const o=n.split("&");for(s=0,i=o.length;s<i;s++)t=o[s].split("="),e[decodeURIComponent(t[0])]=decodeURIComponent(t[1]);return e},Ue=(n,e,t,s,i)=>(o=void 0,r=null,l=!1,c=void 0)=>{const d=r;return r={...r},(async()=>{const h=n.location,y=o||h.pathname+(h.search||"")+(h.hash||"");if("state"in r||(r.state=Y(16)),s(m.loginAsync_begin,{}),r)for(const u of Object.keys(r))u.endsWith(":token_request")&&delete r[u];try{const u=l?t.silent_redirect_uri:t.redirect_uri;c||(c=t.scope);const f=t.extras?{...t.extras,...r}:r;f.nonce||(f.nonce=Y(12));const _={nonce:f.nonce},g=await O(t.service_worker_relative_url,e),k=await i(t.authority,t.authority_configuration);let p;if(g)g.setLoginParams(e,{callbackPath:y,extras:d}),g.startKeepAliveServiceWorker(),await g.initAsync(k,"loginAsync",t),await g.setNonceAsync(_),p=g;else{const P=I(e,t.storage??sessionStorage);P.setLoginParams(e,{callbackPath:y,extras:d}),await P.setNonceAsync(_),p=P}const v={client_id:t.client_id,redirect_uri:u,scope:c,response_type:"code",...f};await Me(p)(k.authorizationEndpoint,v)}catch(u){throw s(m.loginAsync_error,u),u}})()},Be=n=>async(e=!1)=>{try{n.publishEvent(m.loginCallbackAsync_begin,{});const t=n.configuration,s=t.client_id,i=e?t.silent_redirect_uri:t.redirect_uri,o=t.authority,r=t.token_request_timeout,l=await n.initAsync(o,t.authority_configuration),d=B(window.location.href).session_state,a=await O(t.service_worker_relative_url,n.configurationName);let h,y,u,f;if(a)a.startKeepAliveServiceWorker(),await a.initAsync(l,"loginCallbackAsync",t),await a.setSessionStateAsync(d),y=await a.getNonceAsync(),u=a.getLoginParams(n.configurationName),f=await a.getStateAsync(),h=a;else{const S=I(n.configurationName,t.storage??sessionStorage);await S.setSessionStateAsync(d),y=await S.getNonceAsync(),u=S.getLoginParams(n.configurationName),f=await S.getStateAsync(),h=S}const _=B(window.location.toString());if(_.iss&&_.iss!==l.issuer)throw new Error("issuer not valid");if(_.state&&_.state!==f)throw new Error("state not valid");const g={code:_.code,grant_type:"authorization_code",client_id:t.client_id,redirect_uri:i},k={};if(t.token_request_extras)for(const[S,N]of Object.entries(t.token_request_extras))k[S]=N;if(u&&u.extras)for(const[S,N]of Object.entries(u.extras))S.endsWith(":token_request")&&(k[S.replace(":token_request","")]=N);const p=await De(h)(l.tokenEndpoint,{...g,...k},n.configuration.token_renew_mode,r);if(!p.success)throw new Error("Token request failed");let v;const P=p.data.tokens;if(a?(await a.initAsync(i,"syncTokensAsync",t),v=a.getLoginParams(n.configurationName)):v=I(n.configurationName,t.storage).getLoginParams(n.configurationName),p.data.state!==k.state)throw new Error("state is not valid");const{isValid:w,reason:A}=se(P,y.nonce,l);if(!w)throw new Error(`Tokens are not OpenID valid, reason: ${A}`);return await n.startCheckSessionAsync(l.checkSessionIframe,s,d,e),n.publishEvent(m.loginCallbackAsync_end,{}),{tokens:P,state:"request.state",callbackPath:v.callbackPath}}catch(t){throw console.error(t),n.publishEvent(m.loginCallbackAsync_error,t),t}},he={access_token:"access_token",refresh_token:"refresh_token"},je=n=>async e=>{V.clearTimeout(n.timeoutId),n.timeoutId=null,n.checkSessionIFrame&&n.checkSessionIFrame.stop();const t=await O(n.configuration.service_worker_relative_url,n.configurationName);t?await t.clearAsync(e):await I(n.configurationName,n.configuration.storage).clearAsync(e),n.tokens=null,n.userInfo=null},qe=(n,e,t,s,i)=>async(o=void 0,r=null)=>{const l=n.configuration,c=await n.initAsync(l.authority,l.authority_configuration);o&&typeof o!="string"&&(o=void 0,i.warn("callbackPathOrUrl path is not a string"));const d=o??location.pathname+(location.search||"")+(location.hash||"");let a=!1;o&&(a=o.includes("https://")||o.includes("http://"));const h=a?o:s.location.origin+d,y=n.tokens?n.tokens.idToken:"";try{const f=c.revocationEndpoint;if(f){const _=[],g=n.tokens.accessToken;if(g&&l.logout_tokens_to_invalidate.includes(he.access_token)){const p=ue(t)(f,g,Q.access_token,l.client_id);_.push(p)}const k=n.tokens.refreshToken;if(k&&l.logout_tokens_to_invalidate.includes(he.refresh_token)){const p=ue(t)(f,k,Q.refresh_token,l.client_id);_.push(p)}_.length>0&&await Promise.all(_)}}catch(f){i.warn("logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"),i.warn(f)}const u=n.tokens&&n.tokens.idTokenPayload?n.tokens.idTokenPayload.sub:null;await n.destroyAsync("LOGGED_OUT");for(const[f,_]of Object.entries(e))_!==n&&await n.logoutSameTabAsync(n.configuration.client_id,u);if(c.endSessionEndpoint){r||(r={id_token_hint:y},o!==null&&(r.post_logout_redirect_uri=h));let f="";if(r)for(const[_,g]of Object.entries(r))f===""?f+="?":f+="&",f+=`${_}=${encodeURIComponent(g)}`;s.location.href=`${c.endSessionEndpoint}${f}`}else s.location.reload()},Ge=n=>async(e=!1)=>{if(n.userInfo!=null&&!e)return n.userInfo;for(;n.tokens&&!H(n.tokens);)await F(200);if(!n.tokens)return null;const t=n.tokens.accessToken;if(!t)return null;const i=(await n.initAsync(n.configuration.authority,n.configuration.authority_configuration)).userInfoEndpoint,r=await(async l=>{const c=await fetch(i,{headers:{authorization:`Bearer ${l}`}});return c.status!==200?null:c.json()})(t);return n.userInfo=r,r},_e=()=>fetch;class Z{constructor(e){this.authorizationEndpoint=e.authorization_endpoint,this.tokenEndpoint=e.token_endpoint,this.revocationEndpoint=e.revocation_endpoint,this.userInfoEndpoint=e.userinfo_endpoint,this.checkSessionIframe=e.check_session_iframe,this.issuer=e.issuer,this.endSessionEndpoint=e.end_session_endpoint}}const C={},Je=n=>(e,t="default")=>(C[t]||(C[t]=new W(e,t,n)),C[t]),He=async n=>{const{parsedTokens:e,callbackPath:t}=await n.loginCallbackAsync();return n.timeoutId=K(n,e.refreshToken,e.expiresAt),{callbackPath:t}},Xe=n=>Math.floor(Math.random()*n),L=class L{constructor(e,t="default",s){this.initPromise=null,this.tryKeepExistingSessionPromise=null,this.loginPromise=null,this.loginCallbackPromise=null,this.loginCallbackWithAutoTokensRenewPromise=null,this.userInfoPromise=null,this.renewTokensPromise=null,this.logoutPromise=null;let i=e.silent_login_uri;e.silent_redirect_uri&&!e.silent_login_uri&&(i=`${e.silent_redirect_uri.replace("-callback","").replace("callback","")}-login`);let o=e.refresh_time_before_tokens_expiration_in_second??120;o>60&&(o=o-Math.floor(Math.random()*40)),e.logout_tokens_to_invalidate||(e.logout_tokens_to_invalidate=["access_token","refresh_token"]),e.authority_timeout_wellknowurl_in_millisecond||(e.authority_timeout_wellknowurl_in_millisecond=1e4),this.configuration={...e,silent_login_uri:i,monitor_session:e.monitor_session??!1,refresh_time_before_tokens_expiration_in_second:o,silent_login_timeout:e.silent_login_timeout??12e3,token_renew_mode:e.token_renew_mode??q.access_token_or_id_token_invalid},this.getFetch=s??_e,this.configurationName=t,this.tokens=null,this.userInfo=null,this.events=[],this.timeoutId=null,this.synchroniseTokensAsync.bind(this),this.loginCallbackWithAutoTokensRenewAsync.bind(this),this.initAsync.bind(this),this.loginCallbackAsync.bind(this),this.subscribeEvents.bind(this),this.removeEventSubscription.bind(this),this.publishEvent.bind(this),this.destroyAsync.bind(this),this.logoutAsync.bind(this),this.renewTokensAsync.bind(this),this.initAsync(this.configuration.authority,this.configuration.authority_configuration)}subscribeEvents(e){const t=Xe(9999999999999).toString();return this.events.push({id:t,func:e}),t}removeEventSubscription(e){const t=this.events.filter(s=>s.id!==e);this.events=t}publishEvent(e,t){this.events.forEach(s=>{s.func(e,t)})}static get(e="default"){const t=typeof process>"u";if(!Object.prototype.hasOwnProperty.call(C,e)&&t)throw Error(`OIDC library does seem initialized.
|
|
2
|
-
Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${e}"></OidcProvider> compoment.`);return C[e]}_silentLoginCallbackFromIFrame(){if(this.configuration.silent_redirect_uri&&this.configuration.silent_login_uri){const e=B(window.location.href);window.top.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({tokens:this.tokens,sessionState:e.session_state})}`,window.location.origin)}}_silentLoginErrorCallbackFromIFrame(){if(this.configuration.silent_redirect_uri&&this.configuration.silent_login_uri){const e=B(window.location.href);window.top.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({error:e.error})}`,window.location.origin)}}async silentLoginCallbackAsync(){try{await this.loginCallbackAsync(!0),this._silentLoginCallbackFromIFrame()}catch(e){console.error(e),this._silentLoginErrorCallbackFromIFrame()}}async initAsync(e,t){if(this.initPromise!==null)return this.initPromise;const s=async()=>{if(t!=null)return new Z({authorization_endpoint:t.authorization_endpoint,end_session_endpoint:t.end_session_endpoint,revocation_endpoint:t.revocation_endpoint,token_endpoint:t.token_endpoint,userinfo_endpoint:t.userinfo_endpoint,check_session_iframe:t.check_session_iframe,issuer:t.issuer});const o=await O(this.configuration.service_worker_relative_url,this.configurationName)?window.localStorage:null;return await Re(this.getFetch())(e,this.configuration.authority_time_cache_wellknowurl_in_second??60*60,o,this.configuration.authority_timeout_wellknowurl_in_millisecond)};return this.initPromise=s(),this.initPromise.then(i=>(this.initPromise=null,i))}async tryKeepExistingSessionAsync(){if(this.tryKeepExistingSessionPromise!==null)return this.tryKeepExistingSessionPromise;const e=async()=>{let t;if(this.tokens!=null)return!1;this.publishEvent(m.tryKeepExistingSessionAsync_begin,{});try{const s=this.configuration,i=await this.initAsync(s.authority,s.authority_configuration);if(t=await O(s.service_worker_relative_url,this.configurationName),t){const{tokens:o}=await t.initAsync(i,"tryKeepExistingSessionAsync",s);if(o){t.startKeepAliveServiceWorker(),this.tokens=o;const r=t.getLoginParams(this.configurationName);this.timeoutId=K(this,this.tokens.refreshToken,this.tokens.expiresAt,r.extras);const l=await t.getSessionStateAsync();return await this.startCheckSessionAsync(i.check_session_iframe,s.client_id,l),this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!0,message:"tokens inside ServiceWorker are valid"}),!0}this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!1,message:"no exiting session found"})}else{s.service_worker_relative_url&&this.publishEvent(m.service_worker_not_supported_by_browser,{message:"service worker is not supported by this browser"});const o=I(this.configurationName,s.storage??sessionStorage),{tokens:r}=await o.initAsync();if(r){this.tokens=te(r,null,s.token_renew_mode);const l=o.getLoginParams(this.configurationName);this.timeoutId=K(this,r.refreshToken,this.tokens.expiresAt,l.extras);const c=await o.getSessionStateAsync();return await this.startCheckSessionAsync(i.check_session_iframe,s.client_id,c),this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!0,message:"tokens inside storage are valid"}),!0}}return this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!1,message:t?"service worker sessions not retrieved":"session storage sessions not retrieved"}),!1}catch(s){return console.error(s),t&&await t.clearAsync(),this.publishEvent(m.tryKeepExistingSessionAsync_error,"tokens inside ServiceWorker are invalid"),!1}};return this.tryKeepExistingSessionPromise=e(),this.tryKeepExistingSessionPromise.then(t=>(this.tryKeepExistingSessionPromise=null,t))}async startCheckSessionAsync(e,t,s,i=!1){await ve(this,C,this.configuration)(e,t,s,i)}async loginAsync(e=void 0,t=null,s=!1,i=void 0,o=!1){return this.loginPromise!==null?this.loginPromise:o?Se(window,this.configurationName,this.configuration,this.publishEvent.bind(this),this)(t,i):(this.loginPromise=Ue(window,this.configurationName,this.configuration,this.publishEvent.bind(this),this.initAsync.bind(this))(e,t,s,i),this.loginPromise.then(r=>(this.loginPromise=null,r)))}async loginCallbackAsync(e=!1){if(this.loginCallbackPromise!==null)return this.loginCallbackPromise;const t=async()=>{const s=await Be(this)(e),i=s.tokens;return this.tokens=i,await O(this.configuration.service_worker_relative_url,this.configurationName)||I(this.configurationName,this.configuration.storage).setTokens(i),this.publishEvent(L.eventNames.token_aquired,i),{parsedTokens:i,state:s.state,callbackPath:s.callbackPath}};return this.loginCallbackPromise=t(),this.loginCallbackPromise.then(s=>(this.loginCallbackPromise=null,s))}async synchroniseTokensAsync(e,t=0,s=!1,i=null,o){for(;!navigator.onLine&&document.hidden;)await F(1e3),this.publishEvent(m.refreshTokensAsync,{message:"wait because navigator is offline and hidden"});let r=6;for(;!navigator.onLine&&r>0;)await F(1e3),r--,this.publishEvent(m.refreshTokensAsync,{message:`wait because navigator is offline try ${r}`});let l=Math.floor(Math.random()*15)+10;for(;document.hidden&&l>0;)await F(1e3),l--,this.publishEvent(m.refreshTokensAsync,{message:`wait because navigator is hidden try ${l}`});const d=document.hidden?t:t+1;i||(i={});const a=this.configuration,h=(u,f,_=null)=>X(this.configurationName,this.configuration,this.publishEvent.bind(this))(u,f,_),y=async()=>{try{let u;const f=await O(a.service_worker_relative_url,this.configurationName);f?u=f.getLoginParams(this.configurationName):u=I(this.configurationName,a.storage).getLoginParams(this.configurationName);const _=await h({...u.extras,...i,prompt:"none"},u.state);if(_)return o(_.tokens),this.publishEvent(L.eventNames.token_renewed,{}),{tokens:_.tokens,status:"LOGGED"}}catch(u){if(console.error(u),this.publishEvent(m.refreshTokensAsync_silent_error,{message:"exceptionSilent",exception:u.message}),u&&u.message&&u.message.startsWith("oidc"))return o(null),this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token silent"}),{tokens:null,status:"SESSION_LOST"}}return this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token silent return"}),await this.synchroniseTokensAsync(null,d,s,i,o)};if(t>4)return o(null),this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token"}),{tokens:null,status:"SESSION_LOST"};try{const{status:u,tokens:f,nonce:_}=await this.syncTokensInfoAsync(a,this.configurationName,this.tokens,s);switch(u){case"SESSION_LOST":return o(null),this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token session lost"}),{tokens:null,status:"SESSION_LOST"};case"NOT_CONNECTED":return o(null),{tokens:null,status:null};case"TOKENS_VALID":return o(f),{tokens:f,status:"LOGGED_IN"};case"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID":return o(f),this.publishEvent(L.eventNames.token_renewed,{reason:"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"}),{tokens:f,status:"LOGGED_IN"};case"LOGOUT_FROM_ANOTHER_TAB":return o(null),this.publishEvent(m.logout_from_another_tab,{status:"session syncTokensAsync"}),{tokens:null,status:"LOGGED_OUT"};case"REQUIRE_SYNC_TOKENS":return this.publishEvent(m.refreshTokensAsync_begin,{refreshToken:e,status:u,tryNumber:t}),await y();default:{if(this.publishEvent(m.refreshTokensAsync_begin,{refreshToken:e,status:u,tryNumber:t}),!e)return await y();const g=a.client_id,k=a.redirect_uri,p=a.authority,P={...a.token_request_extras?a.token_request_extras:{}};for(const[A,S]of Object.entries(i))A.endsWith(":token_request")&&(P[A.replace(":token_request","")]=S);return await(async()=>{const A={client_id:g,redirect_uri:k,grant_type:"refresh_token",refresh_token:f.refreshToken},S=await this.initAsync(p,a.authority_configuration),N=document.hidden?1e4:3e4*10,M=await $e(this.getFetch())(S.tokenEndpoint,A,P,f,a.token_renew_mode,N);if(M.success){const{isValid:ze,reason:Ye}=se(M.data,_.nonce,S);return ze?(o(M.data),this.publishEvent(m.refreshTokensAsync_end,{success:M.success}),this.publishEvent(L.eventNames.token_renewed,{reason:"REFRESH_TOKEN"}),{tokens:M.data,status:"LOGGED_IN"}):(o(null),this.publishEvent(m.refreshTokensAsync_error,{message:`refresh token return not valid tokens, reason: ${Ye}`}),{tokens:null,status:"SESSION_LOST"})}else return this.publishEvent(m.refreshTokensAsync_silent_error,{message:"bad request",tokenResponse:M}),await this.synchroniseTokensAsync(e,d,s,i,o)})()}}}catch(u){return console.error(u),this.publishEvent(m.refreshTokensAsync_silent_error,{message:"exception",exception:u.message}),this.synchroniseTokensAsync(e,d,s,i,o)}}async syncTokensInfoAsync(e,t,s,i=!1){const o={nonce:null};if(!s)return{tokens:null,status:"NOT_CONNECTED",nonce:o};let r=o;const l=await this.initAsync(e.authority,e.authority_configuration),c=await O(e.service_worker_relative_url,t);if(c){const{status:h,tokens:y}=await c.initAsync(l,"syncTokensAsync",e);if(h==="LOGGED_OUT")return{tokens:null,status:"LOGOUT_FROM_ANOTHER_TAB",nonce:o};if(h==="SESSIONS_LOST")return{tokens:null,status:"SESSIONS_LOST",nonce:o};if(!h||!y)return{tokens:null,status:"REQUIRE_SYNC_TOKENS",nonce:o};if(y.issuedAt!==s.issuedAt){const f=D(e.refresh_time_before_tokens_expiration_in_second,y.expiresAt)>0?"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID":"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID",_=await c.getNonceAsync();return{tokens:y,status:f,nonce:_}}r=await c.getNonceAsync()}else{const h=I(t,e.storage??sessionStorage),{tokens:y,status:u}=await h.initAsync();if(y){if(u==="SESSIONS_LOST")return{tokens:null,status:"SESSIONS_LOST",nonce:o};if(y.issuedAt!==s.issuedAt){const _=D(e.refresh_time_before_tokens_expiration_in_second,y.expiresAt)>0?"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID":"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID",g=await h.getNonceAsync();return{tokens:y,status:_,nonce:g}}}else return{tokens:null,status:"LOGOUT_FROM_ANOTHER_TAB",nonce:o};r=await h.getNonceAsync()}const a=D(e.refresh_time_before_tokens_expiration_in_second,s.expiresAt)>0?"TOKENS_VALID":"TOKENS_INVALID";return i?{tokens:s,status:"FORCE_REFRESH",nonce:r}:{tokens:s,status:a,nonce:r}}loginCallbackWithAutoTokensRenewAsync(){return this.loginCallbackWithAutoTokensRenewPromise!==null?this.loginCallbackWithAutoTokensRenewPromise:(this.loginCallbackWithAutoTokensRenewPromise=He(this),this.loginCallbackWithAutoTokensRenewPromise.then(e=>(this.loginCallbackWithAutoTokensRenewPromise=null,e)))}userInfoAsync(e=!1){return this.userInfoPromise!==null?this.userInfoPromise:(this.userInfoPromise=Ge(this)(e),this.userInfoPromise.then(t=>(this.userInfoPromise=null,t)))}async renewTokensAsync(e=null){if(this.renewTokensPromise!==null)return this.renewTokensPromise;if(this.timeoutId)return V.clearTimeout(this.timeoutId),this.renewTokensPromise=ae(this,this.tokens.refreshToken,!0,e),this.renewTokensPromise.then(t=>(this.renewTokensPromise=null,t))}async destroyAsync(e){return await je(this)(e)}async logoutSameTabAsync(e,t){this.configuration.monitor_session&&this.configuration.client_id===e&&t&&this.tokens&&this.tokens.idTokenPayload&&this.tokens.idTokenPayload.sub===t&&(this.publishEvent(m.logout_from_same_tab,{message:t}),await this.destroyAsync("LOGGED_OUT"))}async logoutOtherTabAsync(e,t){this.configuration.monitor_session&&this.configuration.client_id===e&&t&&this.tokens&&this.tokens.idTokenPayload&&this.tokens.idTokenPayload.sub===t&&(await this.destroyAsync("LOGGED_OUT"),this.publishEvent(m.logout_from_another_tab,{message:"SessionMonitor",sub:t}))}async logoutAsync(e=void 0,t=null){return this.logoutPromise?this.logoutPromise:(this.logoutPromise=qe(this,C,this.getFetch(),window,console)(e,t),this.logoutPromise.then(s=>(this.logoutPromise=null,s)))}};L.getOrCreate=e=>(t,s="default")=>Je(e)(t,s),L.eventNames=m;let W=L;const $=class ${constructor(e){this._oidc=e}subscribeEvents(e){return this._oidc.subscribeEvents(e)}removeEventSubscription(e){this._oidc.removeEventSubscription(e)}publishEvent(e,t){this._oidc.publishEvent(e,t)}static get(e="default"){return new $(W.get(e))}tryKeepExistingSessionAsync(){return this._oidc.tryKeepExistingSessionAsync()}loginAsync(e=void 0,t=null,s=!1,i=void 0,o=!1){return this._oidc.loginAsync(e,t,s,i,o)}logoutAsync(e=void 0,t=null){return this._oidc.logoutAsync(e,t)}silentLoginCallbackAsync(){return this._oidc.silentLoginCallbackAsync()}renewTokensAsync(e=null){return this._oidc.renewTokensAsync(e)}loginCallbackAsync(){return this._oidc.loginCallbackWithAutoTokensRenewAsync()}get tokens(){return this._oidc.tokens}get configuration(){return this._oidc.configuration}async getValidTokenAsync(e=200,t=50){return me(this._oidc,e,t)}async userInfoAsync(e=!1){return this._oidc.userInfoAsync(e)}};$.getOrCreate=e=>(t,s="default")=>new $(W.getOrCreate(e)(t,s)),$.eventNames=W.eventNames;let ee=$;T.TokenRenewMode=q,T.VanillaOidc=ee,T.getFetchDefault=_e,T.getParseQueryStringFromLocation=B,T.getPath=Ve,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${e}"></OidcProvider> compoment.`);return C[e]}_silentLoginCallbackFromIFrame(){if(this.configuration.silent_redirect_uri&&this.configuration.silent_login_uri){const e=B(window.location.href);window.top.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({tokens:this.tokens,sessionState:e.session_state})}`,window.location.origin)}}_silentLoginErrorCallbackFromIFrame(){if(this.configuration.silent_redirect_uri&&this.configuration.silent_login_uri){const e=B(window.location.href);window.top.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({error:e.error})}`,window.location.origin)}}async silentLoginCallbackAsync(){try{await this.loginCallbackAsync(!0),this._silentLoginCallbackFromIFrame()}catch(e){console.error(e),this._silentLoginErrorCallbackFromIFrame()}}async initAsync(e,t){if(this.initPromise!==null)return this.initPromise;const s=async()=>{if(t!=null)return new Z({authorization_endpoint:t.authorization_endpoint,end_session_endpoint:t.end_session_endpoint,revocation_endpoint:t.revocation_endpoint,token_endpoint:t.token_endpoint,userinfo_endpoint:t.userinfo_endpoint,check_session_iframe:t.check_session_iframe,issuer:t.issuer});const o=await O(this.configuration.service_worker_relative_url,this.configurationName)?window.localStorage:null;return await Re(this.getFetch())(e,this.configuration.authority_time_cache_wellknowurl_in_second??60*60,o,this.configuration.authority_timeout_wellknowurl_in_millisecond)};return this.initPromise=s(),this.initPromise.then(i=>(this.initPromise=null,i))}async tryKeepExistingSessionAsync(){if(this.tryKeepExistingSessionPromise!==null)return this.tryKeepExistingSessionPromise;const e=async()=>{let t;if(this.tokens!=null)return!1;this.publishEvent(m.tryKeepExistingSessionAsync_begin,{});try{const s=this.configuration,i=await this.initAsync(s.authority,s.authority_configuration);if(t=await O(s.service_worker_relative_url,this.configurationName),t){const{tokens:o}=await t.initAsync(i,"tryKeepExistingSessionAsync",s);if(o){t.startKeepAliveServiceWorker(),this.tokens=o;const r=t.getLoginParams(this.configurationName);this.timeoutId=K(this,this.tokens.refreshToken,this.tokens.expiresAt,r.extras);const l=await t.getSessionStateAsync();return await this.startCheckSessionAsync(i.check_session_iframe,s.client_id,l),this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!0,message:"tokens inside ServiceWorker are valid"}),!0}this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!1,message:"no exiting session found"})}else{s.service_worker_relative_url&&this.publishEvent(m.service_worker_not_supported_by_browser,{message:"service worker is not supported by this browser"});const o=I(this.configurationName,s.storage??sessionStorage),{tokens:r}=await o.initAsync();if(r){this.tokens=te(r,null,s.token_renew_mode);const l=o.getLoginParams(this.configurationName);this.timeoutId=K(this,r.refreshToken,this.tokens.expiresAt,l.extras);const c=await o.getSessionStateAsync();return await this.startCheckSessionAsync(i.check_session_iframe,s.client_id,c),this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!0,message:"tokens inside storage are valid"}),!0}}return this.publishEvent(m.tryKeepExistingSessionAsync_end,{success:!1,message:t?"service worker sessions not retrieved":"session storage sessions not retrieved"}),!1}catch(s){return console.error(s),t&&await t.clearAsync(),this.publishEvent(m.tryKeepExistingSessionAsync_error,"tokens inside ServiceWorker are invalid"),!1}};return this.tryKeepExistingSessionPromise=e(),this.tryKeepExistingSessionPromise.then(t=>(this.tryKeepExistingSessionPromise=null,t))}async startCheckSessionAsync(e,t,s,i=!1){await ve(this,C,this.configuration)(e,t,s,i)}async loginAsync(e=void 0,t=null,s=!1,i=void 0,o=!1){return this.loginPromise!==null?this.loginPromise:o?Se(window,this.configurationName,this.configuration,this.publishEvent.bind(this),this)(t,i):(this.loginPromise=Ue(window,this.configurationName,this.configuration,this.publishEvent.bind(this),this.initAsync.bind(this))(e,t,s,i),this.loginPromise.then(r=>(this.loginPromise=null,r)))}async loginCallbackAsync(e=!1){if(this.loginCallbackPromise!==null)return this.loginCallbackPromise;const t=async()=>{const s=await Be(this)(e),i=s.tokens;return this.tokens=i,await O(this.configuration.service_worker_relative_url,this.configurationName)||I(this.configurationName,this.configuration.storage).setTokens(i),this.publishEvent(L.eventNames.token_aquired,i),{parsedTokens:i,state:s.state,callbackPath:s.callbackPath}};return this.loginCallbackPromise=t(),this.loginCallbackPromise.then(s=>(this.loginCallbackPromise=null,s))}async synchroniseTokensAsync(e,t=0,s=!1,i=null,o){for(;!navigator.onLine&&document.hidden;)await F(1e3),this.publishEvent(m.refreshTokensAsync,{message:"wait because navigator is offline and hidden"});let r=6;for(;!navigator.onLine&&r>0;)await F(1e3),r--,this.publishEvent(m.refreshTokensAsync,{message:`wait because navigator is offline try ${r}`});let l=Math.floor(Math.random()*15)+10;for(;document.hidden&&l>0;)await F(1e3),l--,this.publishEvent(m.refreshTokensAsync,{message:`wait because navigator is hidden try ${l}`});const d=document.hidden?t:t+1;i||(i={});const a=this.configuration,h=(u,f,_=null)=>X(this.configurationName,this.configuration,this.publishEvent.bind(this))(u,f,_),y=async()=>{try{let u;const f=await O(a.service_worker_relative_url,this.configurationName);f?u=f.getLoginParams(this.configurationName):u=I(this.configurationName,a.storage).getLoginParams(this.configurationName);const _=await h({...u.extras,...i,prompt:"none"},u.state);if(_)return o(_.tokens),this.publishEvent(L.eventNames.token_renewed,{}),{tokens:_.tokens,status:"LOGGED"}}catch(u){if(console.error(u),this.publishEvent(m.refreshTokensAsync_silent_error,{message:"exceptionSilent",exception:u.message}),u&&u.message&&u.message.startsWith("oidc"))return o(null),this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token silent"}),{tokens:null,status:"SESSION_LOST"}}return this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token silent return"}),await this.synchroniseTokensAsync(null,d,s,i,o)};if(t>4)return o(null),this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token"}),{tokens:null,status:"SESSION_LOST"};try{const{status:u,tokens:f,nonce:_}=await this.syncTokensInfoAsync(a,this.configurationName,this.tokens,s);switch(u){case"SESSION_LOST":return o(null),this.publishEvent(m.refreshTokensAsync_error,{message:"refresh token session lost"}),{tokens:null,status:"SESSION_LOST"};case"NOT_CONNECTED":return o(null),{tokens:null,status:null};case"TOKENS_VALID":return o(f),{tokens:f,status:"LOGGED_IN"};case"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID":return o(f),this.publishEvent(L.eventNames.token_renewed,{reason:"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"}),{tokens:f,status:"LOGGED_IN"};case"LOGOUT_FROM_ANOTHER_TAB":return o(null),this.publishEvent(m.logout_from_another_tab,{status:"session syncTokensAsync"}),{tokens:null,status:"LOGGED_OUT"};case"REQUIRE_SYNC_TOKENS":return this.publishEvent(m.refreshTokensAsync_begin,{refreshToken:e,status:u,tryNumber:t}),await y();default:{if(this.publishEvent(m.refreshTokensAsync_begin,{refreshToken:e,status:u,tryNumber:t}),!e)return await y();const g=a.client_id,k=a.redirect_uri,p=a.authority,P={...a.token_request_extras?a.token_request_extras:{}};for(const[A,S]of Object.entries(i))A.endsWith(":token_request")&&(P[A.replace(":token_request","")]=S);return await(async()=>{const A={client_id:g,redirect_uri:k,grant_type:"refresh_token",refresh_token:f.refreshToken},S=await this.initAsync(p,a.authority_configuration),N=document.hidden?1e4:3e4*10,M=await $e(this.getFetch())(S.tokenEndpoint,A,P,f,a.token_renew_mode,N);if(M.success){const{isValid:ze,reason:Ye}=se(M.data,_.nonce,S);return ze?(o(M.data),this.publishEvent(m.refreshTokensAsync_end,{success:M.success}),this.publishEvent(L.eventNames.token_renewed,{reason:"REFRESH_TOKEN"}),{tokens:M.data,status:"LOGGED_IN"}):(o(null),this.publishEvent(m.refreshTokensAsync_error,{message:`refresh token return not valid tokens, reason: ${Ye}`}),{tokens:null,status:"SESSION_LOST"})}else return this.publishEvent(m.refreshTokensAsync_silent_error,{message:"bad request",tokenResponse:M}),await this.synchroniseTokensAsync(e,d,s,i,o)})()}}}catch(u){return console.error(u),this.publishEvent(m.refreshTokensAsync_silent_error,{message:"exception",exception:u.message}),this.synchroniseTokensAsync(e,d,s,i,o)}}async syncTokensInfoAsync(e,t,s,i=!1){const o={nonce:null};if(!s)return{tokens:null,status:"NOT_CONNECTED",nonce:o};let r=o;const l=await this.initAsync(e.authority,e.authority_configuration),c=await O(e.service_worker_relative_url,t);if(c){const{status:h,tokens:y}=await c.initAsync(l,"syncTokensAsync",e);if(h==="LOGGED_OUT")return{tokens:null,status:"LOGOUT_FROM_ANOTHER_TAB",nonce:o};if(h==="SESSIONS_LOST")return{tokens:null,status:"SESSIONS_LOST",nonce:o};if(!h||!y)return{tokens:null,status:"REQUIRE_SYNC_TOKENS",nonce:o};if(y.issuedAt!==s.issuedAt){const f=D(e.refresh_time_before_tokens_expiration_in_second,y.expiresAt)>0?"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID":"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID",_=await c.getNonceAsync();return{tokens:y,status:f,nonce:_}}r=await c.getNonceAsync()}else{const h=I(t,e.storage??sessionStorage),{tokens:y,status:u}=await h.initAsync();if(y){if(u==="SESSIONS_LOST")return{tokens:null,status:"SESSIONS_LOST",nonce:o};if(y.issuedAt!==s.issuedAt){const _=D(e.refresh_time_before_tokens_expiration_in_second,y.expiresAt)>0?"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID":"TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID",g=await h.getNonceAsync();return{tokens:y,status:_,nonce:g}}}else return{tokens:null,status:"LOGOUT_FROM_ANOTHER_TAB",nonce:o};r=await h.getNonceAsync()}const a=D(e.refresh_time_before_tokens_expiration_in_second,s.expiresAt)>0?"TOKENS_VALID":"TOKENS_INVALID";return i?{tokens:s,status:"FORCE_REFRESH",nonce:r}:{tokens:s,status:a,nonce:r}}loginCallbackWithAutoTokensRenewAsync(){return this.loginCallbackWithAutoTokensRenewPromise!==null?this.loginCallbackWithAutoTokensRenewPromise:(this.loginCallbackWithAutoTokensRenewPromise=He(this),this.loginCallbackWithAutoTokensRenewPromise.then(e=>(this.loginCallbackWithAutoTokensRenewPromise=null,e)))}userInfoAsync(e=!1){return this.userInfoPromise!==null?this.userInfoPromise:(this.userInfoPromise=Ge(this)(e),this.userInfoPromise.then(t=>(this.userInfoPromise=null,t)))}async renewTokensAsync(e=null){if(this.renewTokensPromise!==null)return this.renewTokensPromise;if(this.timeoutId)return V.clearTimeout(this.timeoutId),this.renewTokensPromise=ae(this,this.tokens.refreshToken,!0,e),this.renewTokensPromise.then(t=>(this.renewTokensPromise=null,t))}async destroyAsync(e){return await je(this)(e)}async logoutSameTabAsync(e,t){this.configuration.monitor_session&&this.configuration.client_id===e&&t&&this.tokens&&this.tokens.idTokenPayload&&this.tokens.idTokenPayload.sub===t&&(this.publishEvent(m.logout_from_same_tab,{message:t}),await this.destroyAsync("LOGGED_OUT"))}async logoutOtherTabAsync(e,t){this.configuration.monitor_session&&this.configuration.client_id===e&&t&&this.tokens&&this.tokens.idTokenPayload&&this.tokens.idTokenPayload.sub===t&&(await this.destroyAsync("LOGGED_OUT"),this.publishEvent(m.logout_from_another_tab,{message:"SessionMonitor",sub:t}))}async logoutAsync(e=void 0,t=null){return this.logoutPromise?this.logoutPromise:(this.logoutPromise=qe(this,C,this.getFetch(),window,console)(e,t),this.logoutPromise.then(s=>(this.logoutPromise=null,s)))}};L.getOrCreate=e=>(t,s="default")=>Je(e)(t,s),L.eventNames=m;let W=L;const $=class ${constructor(e){this._oidc=e}subscribeEvents(e){return this._oidc.subscribeEvents(e)}removeEventSubscription(e){this._oidc.removeEventSubscription(e)}publishEvent(e,t){this._oidc.publishEvent(e,t)}static get(e="default"){return new $(W.get(e))}tryKeepExistingSessionAsync(){return this._oidc.tryKeepExistingSessionAsync()}loginAsync(e=void 0,t=null,s=!1,i=void 0,o=!1){return this._oidc.loginAsync(e,t,s,i,o)}logoutAsync(e=void 0,t=null){return this._oidc.logoutAsync(e,t)}silentLoginCallbackAsync(){return this._oidc.silentLoginCallbackAsync()}renewTokensAsync(e=null){return this._oidc.renewTokensAsync(e)}loginCallbackAsync(){return this._oidc.loginCallbackWithAutoTokensRenewAsync()}get tokens(){return this._oidc.tokens}get configuration(){return this._oidc.configuration}async getValidTokenAsync(e=200,t=50){return me(this._oidc,e,t)}async userInfoAsync(e=!1){return this._oidc.userInfoAsync(e)}};$.getOrCreate=e=>(t,s="default")=>new $(W.getOrCreate(e)(t,s)),$.eventNames=W.eventNames;let ee=$;T.OidcClient=ee,T.TokenRenewMode=q,T.getFetchDefault=_e,T.getParseQueryStringFromLocation=B,T.getPath=Ve,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iniWorker.spec.d.ts","sourceRoot":"","sources":["../src/
|
|
1
|
+
{"version":3,"file":"iniWorker.spec.d.ts","sourceRoot":"","sources":["../src/iniWorker.spec.ts"],"names":[],"mappings":""}
|
package/dist/initSession.d.ts
CHANGED
package/dist/initWorker.d.ts
CHANGED
package/dist/login.d.ts
CHANGED
package/dist/logout.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export declare const oidcLogoutTokens: {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const destroyAsync: (oidc: any) => (status: any) => Promise<void>;
|
|
7
7
|
export declare const logoutAsync: (oidc: any, oidcDatabase: any, fetch: any, window: any, console: any) => (callbackPathOrUrl?: string | null | undefined, extras?: StringMap) => Promise<void>;
|
|
8
|
-
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.spec.d.ts","sourceRoot":"","sources":["../src/
|
|
1
|
+
{"version":3,"file":"logout.spec.d.ts","sourceRoot":"","sources":["../src/logout.spec.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
package/dist/oidc.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ import { Fetch, OidcConfiguration, StringMap } from './types.js';
|
|
|
4
4
|
export interface EventSubscriber {
|
|
5
5
|
(name: string, data: any): any;
|
|
6
6
|
}
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class OidcClient {
|
|
8
8
|
private _oidc;
|
|
9
9
|
constructor(oidc: Oidc);
|
|
10
10
|
subscribeEvents(func: EventSubscriber): string;
|
|
11
11
|
removeEventSubscription(id: string): void;
|
|
12
12
|
publishEvent(eventName: string, data: any): void;
|
|
13
|
-
static getOrCreate: (getFetch: () => Fetch) => (configuration: OidcConfiguration, name?: string) =>
|
|
14
|
-
static get(name?: string):
|
|
13
|
+
static getOrCreate: (getFetch: () => Fetch) => (configuration: OidcConfiguration, name?: string) => OidcClient;
|
|
14
|
+
static get(name?: string): OidcClient;
|
|
15
15
|
static eventNames: {
|
|
16
16
|
service_worker_not_supported_by_browser: string;
|
|
17
17
|
token_aquired: string;
|
|
@@ -82,4 +82,3 @@ export interface OidcAddressClaim {
|
|
|
82
82
|
postal_code?: string;
|
|
83
83
|
country?: string;
|
|
84
84
|
}
|
|
85
|
-
//# sourceMappingURL=vanillaOidc.d.ts.map
|
package/dist/parseTokens.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseTokens.spec.d.ts","sourceRoot":"","sources":["../src/
|
|
1
|
+
{"version":3,"file":"parseTokens.spec.d.ts","sourceRoot":"","sources":["../src/parseTokens.spec.ts"],"names":[],"mappings":""}
|
package/dist/renewTokens.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { StringMap } from './types.js';
|
|
2
2
|
export declare function renewTokensAndStartTimerAsync(oidc: any, refreshToken: any, forceRefresh?: boolean, extras?: StringMap): Promise<any>;
|
|
3
3
|
export declare const autoRenewTokens: (oidc: any, refreshToken: any, expiresAt: any, extras?: StringMap) => number | NodeJS.Timeout;
|
|
4
|
-
//# sourceMappingURL=renewTokens.d.ts.map
|
package/dist/requests.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.spec.d.ts","sourceRoot":"","sources":["../src/
|
|
1
|
+
{"version":3,"file":"requests.spec.d.ts","sourceRoot":"","sources":["../src/requests.spec.ts"],"names":[],"mappings":""}
|
package/dist/route-utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-utils.spec.d.ts","sourceRoot":"","sources":["../src/
|
|
1
|
+
{"version":3,"file":"route-utils.spec.d.ts","sourceRoot":"","sources":["../src/route-utils.spec.ts"],"names":[],"mappings":""}
|
package/dist/silentLogin.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ export type SilentLoginResponse = {
|
|
|
7
7
|
export declare const _silentLoginAsync: (configurationName: string, configuration: OidcConfiguration, publishEvent: Function) => (extras?: StringMap, state?: string, scope?: string) => Promise<SilentLoginResponse>;
|
|
8
8
|
export declare const defaultSilentLoginAsync: (window: any, configurationName: any, configuration: OidcConfiguration, publishEvent: (string: any, any: any) => void, oidc: any) => (extras?: StringMap, scope?: string) => Promise<unknown>;
|
|
9
9
|
export default defaultSilentLoginAsync;
|
|
10
|
-
//# sourceMappingURL=silentLogin.d.ts.map
|
package/dist/timer.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,KAAK,CAAC;AAExC,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,eAAe,CAAC;AAE3D,MAAM,MAAM,iBAAiB,GAAG;IA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
1
|
{
|
|
2
2
|
"name": "@axa-fr/oidc-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/AxaGuilDEv/react-oidc.git"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@axa-fr/oidc-client-service-worker": "
|
|
23
|
+
"@axa-fr/oidc-client-service-worker": "7.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@testing-library/dom": "^9.3.1",
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface EventSubscriber {
|
|
|
6
6
|
(name: string, data:any);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export class
|
|
9
|
+
export class OidcClient {
|
|
10
10
|
private _oidc: Oidc;
|
|
11
11
|
constructor(oidc: Oidc) {
|
|
12
12
|
this._oidc = oidc;
|
|
@@ -24,12 +24,12 @@ export class VanillaOidc {
|
|
|
24
24
|
this._oidc.publishEvent(eventName, data);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
static getOrCreate = (getFetch : () => Fetch) => (configuration:OidcConfiguration, name = 'default'):
|
|
28
|
-
return new
|
|
27
|
+
static getOrCreate = (getFetch : () => Fetch) => (configuration:OidcConfiguration, name = 'default'): OidcClient => {
|
|
28
|
+
return new OidcClient(Oidc.getOrCreate(getFetch)(configuration, name));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
static get(name = 'default'):
|
|
32
|
-
return new
|
|
31
|
+
static get(name = 'default'):OidcClient {
|
|
32
|
+
return new OidcClient(Oidc.get(name));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
static eventNames = Oidc.eventNames;
|
package/dist/cache.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/src/cache.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,uEAexB,CAAC;AAEF,eAAO,MAAM,QAAQ,gEAMpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkSession.d.ts","sourceRoot":"","sources":["../src/src/checkSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,sBAAsB,SAAS,GAAG,gBAAe,GAAG,iBAAiB,iBAAiB,4HAsDlG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkSessionIFrame.d.ts","sourceRoot":"","sources":["../src/src/checkSessionIFrame.ts"],"names":[],"mappings":"AAIA,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAM;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAM;IAChC,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,kBAAkB,CAAM;IAChC,OAAO,CAAC,MAAM,CAAS;gBACX,QAAQ,KAAA,EAAE,SAAS,KAAA,EAAE,GAAG,KAAA,EAAE,QAAQ,SAAkB,EAAE,WAAW,UAAO;IAoBpF,IAAI;IAWJ,QAAQ,CAAC,CAAC,KAAA;IAoBV,KAAK,CAAC,aAAa,KAAA;IAUnB,IAAI;CAOP"}
|
package/dist/crypto.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/src/crypto.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,cAAc,SAAU,MAAM,WAYxC,CAAC;AAEJ,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,cAQzC;AACC,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,QAAQ,MAAM,CAcnE,CAAC"}
|
package/dist/events.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/src/events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BtB,CAAC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,+BAA+B,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,YAAY,EACV,sBAAsB,EACtB,KAAK,EACL,iBAAiB,EACjB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initSession.d.ts","sourceRoot":"","sources":["../src/src/initSession.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;wCA4CsB,MAAM;;;2BAgBb,MAAM;;;CA4B5C,CAAC"}
|
package/dist/initWorker.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initWorker.d.ts","sourceRoot":"","sources":["../src/src/initWorker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,kBAAkB;;;CAmE9B,CAAC;AAkCF,eAAO,MAAM,UAAU,yCAEtB,CAAC;AAsBF,eAAO,MAAM,SAAS,mCAQrB,CAAC;AAgBF,eAAO,MAAM,eAAe;;6EAuDmD,iBAAiB;;;;;;yCAwBjD,MAAM;;;;;;;wCA2BP,MAAM;;;2BAuBb,MAAM;;yCAgBQ,MAAM;EAsB1D,CAAC"}
|
package/dist/login.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/src/login.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG1D,eAAO,MAAM,iBAAiB,uDAA6C,iBAAiB,2CAA+B,IAAI,aAAY,QAAQ,qBAAmB,MAAM,WAAqB,SAAS,oCAAuC,MAAM,kBA6DtP,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;EAoG9B,CAAC"}
|
package/dist/logout.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../src/src/logout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC;AAEF,eAAO,MAAM,YAAY,+CAexB,CAAC;AAEF,eAAO,MAAM,WAAW,gGAA6E,MAAM,GAAG,IAAI,GAAG,SAAS,WAAsB,SAAS,kBAwE5J,CAAC"}
|
package/dist/oidc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../src/src/oidc.ts"],"names":[],"mappings":"AAOA,OAAO,EAIH,MAAM,EACT,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGzF,eAAO,MAAM,eAAe,oBA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+0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renewTokens.d.ts","sourceRoot":"","sources":["../src/src/renewTokens.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,wBAAsB,6BAA6B,CAAC,IAAI,KAAA,EAAE,YAAY,KAAA,EAAE,YAAY,UAAQ,EAAE,MAAM,GAAC,SAAgB,gBAmBpH;AAED,eAAO,MAAM,eAAe,0DAA0C,SAAS,4BAQ9E,CAAC"}
|
package/dist/requests.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../src/src/requests.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qCAAqC,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG9C,eAAO,MAAM,eAAe,oCAAsC,MAAM,sEACpE,QAAQ,qCAAqC,CAkBhD,CAAC;AAwBF,eAAO,MAAM,UAAU;;;CAGtB,CAAC;AAEF,eAAO,MAAM,6BAA6B;;EA4BzC,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAAU,KAAK,2EAA6D,MAAM;;;;;;;;EA8BtH,CAAC;AAEF,eAAO,MAAM,gCAAgC,YAAa,GAAG,wBAAyB,SAAS,kBAoB9F,CAAC;AAEF,eAAO,MAAM,6BAA6B,YAAY,GAAG,6CAAyC,MAAM;;;;;;;;;;;EA6BvG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-utils.d.ts","sourceRoot":"","sources":["../src/src/route-utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAAU,MAAM;;;;;;;;;CAoCvC,CAAC;AAEF,eAAO,MAAM,OAAO,SAAU,MAAM,WAkBnC,CAAC;AAEF,eAAO,MAAM,+BAA+B,SAAU,MAAM,QAK3D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"silentLogin.d.ts","sourceRoot":"","sources":["../src/src/silentLogin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG;IAC9B,MAAM,EAAC,MAAM,CAAC;IACd,YAAY,EAAC,MAAM,CAAC;CACvB,CAAC;AAGF,eAAO,MAAM,iBAAiB,sBAAsB,MAAM,iBAAgB,iBAAiB,gBAAe,QAAQ,eAAa,SAAS,UAAe,MAAM,UAAe,MAAM,KAAS,QAAQ,mBAAmB,CA0FrN,CAAC;AAGF,eAAO,MAAM,uBAAuB,uDAA6C,iBAAiB,2CAA+B,IAAI,QAAO,GAAG,eAAa,SAAS,UAAe,MAAM,qBAqCzL,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
package/dist/timer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../src/src/timer.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK;;;;;;;;;;CAgKP,CAAC;AAEL,eAAe,KAAK,CAAC"}
|
package/dist/user.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../src/src/user.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,oDAoCzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vanillaOidc.d.ts","sourceRoot":"","sources":["../src/src/vanillaOidc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,S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