@schibsted/account-sdk-browser 4.5.1 → 4.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/identity.d.ts CHANGED
@@ -297,12 +297,12 @@ export class Identity {
297
297
  * and store that info in localStorage. Widget will be display only if user is logged in to SSO.
298
298
  *
299
299
  * @async
300
- * @param {LoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
300
+ * @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
301
301
  * continue action. `state` might be string or async function.
302
302
  * @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
303
303
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
304
304
  */
305
- showSimplifiedLoginWidget(loginParams: LoginOptions, options?: SimplifiedLoginWidgetOptions): Promise<boolean | SDKError>;
305
+ showSimplifiedLoginWidget(loginParams: SimplifiedLoginWidgetLoginOptions, options?: SimplifiedLoginWidgetOptions): Promise<boolean | SDKError>;
306
306
  }
307
307
  export default Identity;
308
308
  export type LoginOptions = {
@@ -353,6 +353,76 @@ export type LoginOptions = {
353
353
  * in place of default teaser
354
354
  */
355
355
  teaser?: string;
356
+ /**
357
+ * - Specifies the allowable elapsed time in seconds since
358
+ * the last time the End-User was actively authenticated. If last authentication time is more
359
+ * than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
360
+ * spec section 3.1.2.1 for more information
361
+ */
362
+ maxAge?: number | string;
363
+ /**
364
+ * - Optional parameter to overwrite client locale setting.
365
+ * New flows supports nb_NO, fi_FI, sv_SE, en_US
366
+ */
367
+ locale?: string;
368
+ /**
369
+ * - display username and password on one screen
370
+ */
371
+ oneStepLogin?: boolean;
372
+ /**
373
+ * - String that specifies whether the Authorization Server prompts the
374
+ * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
375
+ */
376
+ prompt?: string;
377
+ };
378
+ export type SimplifiedLoginWidgetLoginOptions = {
379
+ /**
380
+ * - An opaque value used by the client to maintain state between
381
+ * the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
382
+ */
383
+ state: string | (() => (string | Promise<string>));
384
+ /**
385
+ * - Authentication Context Class Reference Values. If
386
+ * omitted, the user will be asked to authenticate using username+password.
387
+ * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
388
+ * `password` (will force password confirmation, even if user is already logged in). Those values might
389
+ * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
390
+ * to verify AMR (Authentication Methods References) claim in ID token.
391
+ * Might also be used to ensure additional acr (sms, otp) for already logged in users.
392
+ * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
393
+ * one time password using sms.
394
+ */
395
+ acrValues?: string;
396
+ /**
397
+ * - The OAuth scopes for the tokens. This is a list of
398
+ * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
399
+ * includes the id token which can be useful for getting information about the user. Omitting
400
+ * scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
401
+ * aren’t allowed to request. {@link https ://tools.ietf.org/html/rfc6749#section-3.3}
402
+ */
403
+ scope?: string;
404
+ /**
405
+ * - Redirect uri that will receive the
406
+ * code. Must exactly match a redirectUri from your client in self-service
407
+ */
408
+ redirectUri?: string;
409
+ /**
410
+ * - Should we try to open a popup window?
411
+ */
412
+ preferPopup?: boolean;
413
+ /**
414
+ * - user email or UUID hint
415
+ */
416
+ loginHint?: string;
417
+ /**
418
+ * - Pulse tag
419
+ */
420
+ tag?: string;
421
+ /**
422
+ * - Teaser slug. Teaser with given slug will be displayed
423
+ * in place of default teaser
424
+ */
425
+ teaser?: string;
356
426
  /**
357
427
  * - Specifies the allowable elapsed time in seconds since
358
428
  * the last time the End-User was actively authenticated. If last authentication time is more
package/src/identity.js CHANGED
@@ -48,7 +48,42 @@ const { version } = require('../package.json');
48
48
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
49
49
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
50
50
  * @property {boolean} [oneStepLogin] - display username and password on one screen
51
- * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
51
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
52
+ * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
53
+ */
54
+ /**
55
+ * @typedef {object} SimplifiedLoginWidgetLoginOptions
56
+ * @property {string|function(): (string|Promise<string>)} state - An opaque value used by the client to maintain state between
57
+ * the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
58
+ * @property {string} [acrValues] - Authentication Context Class Reference Values. If
59
+ * omitted, the user will be asked to authenticate using username+password.
60
+ * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
61
+ * `password` (will force password confirmation, even if user is already logged in). Those values might
62
+ * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
63
+ * to verify AMR (Authentication Methods References) claim in ID token.
64
+ * Might also be used to ensure additional acr (sms, otp) for already logged in users.
65
+ * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
66
+ * one time password using sms.
67
+ * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
68
+ * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
69
+ * includes the id token which can be useful for getting information about the user. Omitting
70
+ * scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
71
+ * aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
72
+ * @property {string} [redirectUri] - Redirect uri that will receive the
73
+ * code. Must exactly match a redirectUri from your client in self-service
74
+ * @property {boolean} [preferPopup] - Should we try to open a popup window?
75
+ * @property {string} [loginHint] - user email or UUID hint
76
+ * @property {string} [tag] - Pulse tag
77
+ * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
78
+ * in place of default teaser
79
+ * @property {number|string} [maxAge] - Specifies the allowable elapsed time in seconds since
80
+ * the last time the End-User was actively authenticated. If last authentication time is more
81
+ * than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
82
+ * spec section 3.1.2.1 for more information
83
+ * @property {string} [locale] - Optional parameter to overwrite client locale setting.
84
+ * New flows supports nb_NO, fi_FI, sv_SE, en_US
85
+ * @property {boolean} [oneStepLogin] - display username and password on one screen
86
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
52
87
  * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
53
88
  */
54
89
 
@@ -813,7 +848,7 @@ export class Identity extends EventEmitter {
813
848
  * and store that info in localStorage. Widget will be display only if user is logged in to SSO.
814
849
  *
815
850
  * @async
816
- * @param {LoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
851
+ * @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
817
852
  * continue action. `state` might be string or async function.
818
853
  * @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
819
854
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError