@wazo/sdk 0.37.36 → 0.37.37

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.
@@ -2208,6 +2208,7 @@ class ApiRequester {
2208
2208
  /* */
2209
2209
 
2210
2210
  const DEFAULT_BACKEND_USER = 'wazo_user';
2211
+ const BACKEND_LDAP_USER = 'ldap_user';
2211
2212
  const DETAULT_EXPIRATION = 3600;
2212
2213
 
2213
2214
  var authMethods = (client , baseUrl ) => ({
@@ -5609,6 +5610,7 @@ var getApiClient = (forServer ) => {
5609
5610
 
5610
5611
  class InvalidSubscription extends Error {}
5611
5612
  class InvalidAuthorization extends Error {}
5613
+ class NoTenantIdError extends Error {}
5612
5614
 
5613
5615
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5614
5616
 
@@ -5622,11 +5624,15 @@ class Auth {
5622
5624
 
5623
5625
 
5624
5626
 
5627
+
5628
+
5625
5629
 
5626
5630
  constructor() {
5627
5631
  this.expiration = DETAULT_EXPIRATION;
5628
5632
  this.authenticated = false;
5629
5633
  this.minSubscriptionType = null;
5634
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5635
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5630
5636
  }
5631
5637
 
5632
5638
  init(clientId ,
@@ -5659,12 +5665,18 @@ class Auth {
5659
5665
  setFetchOptions(options);
5660
5666
  }
5661
5667
 
5662
- async logIn(username , password ) {
5668
+ async logIn(username , password , backend , tenantId ) {
5669
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5670
+ throw new NoTenantIdError('No tenant id');
5671
+ }
5672
+
5663
5673
  this.authenticated = false;
5664
5674
  this.session = null;
5665
5675
  const rawSession = await getApiClient().auth.logIn({
5666
5676
  username,
5667
5677
  password,
5678
+ backend,
5679
+ tenantId,
5668
5680
  expiration: this.expiration,
5669
5681
  mobile: this.mobile,
5670
5682
  });
@@ -13943,6 +13955,7 @@ const Wazo = {
13943
13955
  InvalidAuthorization,
13944
13956
  CanceledCallError,
13945
13957
  SFUNotAvailableError,
13958
+ NoTenantIdError,
13946
13959
  };
13947
13960
 
13948
13961
  if (window) {
@@ -2208,6 +2208,7 @@ class ApiRequester {
2208
2208
  /* */
2209
2209
 
2210
2210
  const DEFAULT_BACKEND_USER = 'wazo_user';
2211
+ const BACKEND_LDAP_USER = 'ldap_user';
2211
2212
  const DETAULT_EXPIRATION = 3600;
2212
2213
 
2213
2214
  var authMethods = (client , baseUrl ) => ({
@@ -5609,6 +5610,7 @@ var getApiClient = (forServer ) => {
5609
5610
 
5610
5611
  class InvalidSubscription extends Error {}
5611
5612
  class InvalidAuthorization extends Error {}
5613
+ class NoTenantIdError extends Error {}
5612
5614
 
5613
5615
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5614
5616
 
@@ -5622,11 +5624,15 @@ class Auth {
5622
5624
 
5623
5625
 
5624
5626
 
5627
+
5628
+
5625
5629
 
5626
5630
  constructor() {
5627
5631
  this.expiration = DETAULT_EXPIRATION;
5628
5632
  this.authenticated = false;
5629
5633
  this.minSubscriptionType = null;
5634
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5635
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5630
5636
  }
5631
5637
 
5632
5638
  init(clientId ,
@@ -5659,12 +5665,18 @@ class Auth {
5659
5665
  setFetchOptions(options);
5660
5666
  }
5661
5667
 
5662
- async logIn(username , password ) {
5668
+ async logIn(username , password , backend , tenantId ) {
5669
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5670
+ throw new NoTenantIdError('No tenant id');
5671
+ }
5672
+
5663
5673
  this.authenticated = false;
5664
5674
  this.session = null;
5665
5675
  const rawSession = await getApiClient().auth.logIn({
5666
5676
  username,
5667
5677
  password,
5678
+ backend,
5679
+ tenantId,
5668
5680
  expiration: this.expiration,
5669
5681
  mobile: this.mobile,
5670
5682
  });
@@ -13927,6 +13939,7 @@ const Wazo = {
13927
13939
  InvalidAuthorization,
13928
13940
  CanceledCallError,
13929
13941
  SFUNotAvailableError,
13942
+ NoTenantIdError,
13930
13943
  };
13931
13944
 
13932
13945
  if (window) {
package/lib/api/auth.js CHANGED
@@ -954,6 +954,7 @@ class Session {
954
954
  /* */
955
955
 
956
956
  const DEFAULT_BACKEND_USER = 'wazo_user';
957
+ const BACKEND_LDAP_USER = 'ldap_user';
957
958
  const DETAULT_EXPIRATION = 3600;
958
959
 
959
960
  var auth = (client , baseUrl ) => ({
@@ -1197,5 +1198,7 @@ var auth = (client , baseUrl ) => ({
1197
1198
  client.delete(`${baseUrl}/users/${userUuid}/external/${provider}`),
1198
1199
  });
1199
1200
 
1201
+ exports.BACKEND_LDAP_USER = BACKEND_LDAP_USER;
1202
+ exports.DEFAULT_BACKEND_USER = DEFAULT_BACKEND_USER;
1200
1203
  exports.DETAULT_EXPIRATION = DETAULT_EXPIRATION;
1201
1204
  exports.default = auth;
package/lib/index.js CHANGED
@@ -2220,6 +2220,7 @@ class Session {
2220
2220
  /* */
2221
2221
 
2222
2222
  const DEFAULT_BACKEND_USER = 'wazo_user';
2223
+ const BACKEND_LDAP_USER = 'ldap_user';
2223
2224
  const DETAULT_EXPIRATION = 3600;
2224
2225
 
2225
2226
  var authMethods = (client , baseUrl ) => ({
@@ -11707,6 +11708,7 @@ const getCallableNumber = (number , country ) => {
11707
11708
 
11708
11709
  class InvalidSubscription extends Error {}
11709
11710
  class InvalidAuthorization extends Error {}
11711
+ class NoTenantIdError extends Error {}
11710
11712
 
11711
11713
  const logger$5 = IssueReporter$1.loggerFor('simple-auth');
11712
11714
 
@@ -11720,11 +11722,15 @@ class Auth {
11720
11722
 
11721
11723
 
11722
11724
 
11725
+
11726
+
11723
11727
 
11724
11728
  constructor() {
11725
11729
  this.expiration = DETAULT_EXPIRATION;
11726
11730
  this.authenticated = false;
11727
11731
  this.minSubscriptionType = null;
11732
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
11733
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
11728
11734
  }
11729
11735
 
11730
11736
  init(clientId ,
@@ -11757,12 +11763,18 @@ class Auth {
11757
11763
  setFetchOptions(options);
11758
11764
  }
11759
11765
 
11760
- async logIn(username , password ) {
11766
+ async logIn(username , password , backend , tenantId ) {
11767
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
11768
+ throw new NoTenantIdError('No tenant id');
11769
+ }
11770
+
11761
11771
  this.authenticated = false;
11762
11772
  this.session = null;
11763
11773
  const rawSession = await getApiClient().auth.logIn({
11764
11774
  username,
11765
11775
  password,
11776
+ backend,
11777
+ tenantId,
11766
11778
  expiration: this.expiration,
11767
11779
  mobile: this.mobile,
11768
11780
  });
@@ -14092,6 +14104,7 @@ const Wazo = {
14092
14104
  InvalidAuthorization,
14093
14105
  CanceledCallError,
14094
14106
  SFUNotAvailableError,
14107
+ NoTenantIdError,
14095
14108
  };
14096
14109
 
14097
14110
  if (window) {
@@ -2220,6 +2220,7 @@ class ApiRequester {
2220
2220
  /* */
2221
2221
 
2222
2222
  const DEFAULT_BACKEND_USER = 'wazo_user';
2223
+ const BACKEND_LDAP_USER = 'ldap_user';
2223
2224
  const DETAULT_EXPIRATION = 3600;
2224
2225
 
2225
2226
  var authMethods = (client , baseUrl ) => ({
@@ -13691,6 +13692,7 @@ const Wazo = {
13691
13692
  InvalidAuthorization,
13692
13693
  CanceledCallError,
13693
13694
  SFUNotAvailableError,
13695
+ NoTenantIdError,
13694
13696
  };
13695
13697
 
13696
13698
  if (window) {
@@ -13704,6 +13706,7 @@ if (global) {
13704
13706
 
13705
13707
  class InvalidSubscription extends Error {}
13706
13708
  class InvalidAuthorization extends Error {}
13709
+ class NoTenantIdError extends Error {}
13707
13710
 
13708
13711
  const logger = IssueReporter$1.loggerFor('simple-auth');
13709
13712
 
@@ -13717,11 +13720,15 @@ class Auth {
13717
13720
 
13718
13721
 
13719
13722
 
13723
+
13724
+
13720
13725
 
13721
13726
  constructor() {
13722
13727
  this.expiration = DETAULT_EXPIRATION;
13723
13728
  this.authenticated = false;
13724
13729
  this.minSubscriptionType = null;
13730
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
13731
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
13725
13732
  }
13726
13733
 
13727
13734
  init(clientId ,
@@ -13754,12 +13761,18 @@ class Auth {
13754
13761
  setFetchOptions(options);
13755
13762
  }
13756
13763
 
13757
- async logIn(username , password ) {
13764
+ async logIn(username , password , backend , tenantId ) {
13765
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
13766
+ throw new NoTenantIdError('No tenant id');
13767
+ }
13768
+
13758
13769
  this.authenticated = false;
13759
13770
  this.session = null;
13760
13771
  const rawSession = await getApiClient().auth.logIn({
13761
13772
  username,
13762
13773
  password,
13774
+ backend,
13775
+ tenantId,
13763
13776
  expiration: this.expiration,
13764
13777
  mobile: this.mobile,
13765
13778
  });
@@ -13966,4 +13979,5 @@ var Auth$1 = global.wazoAuthInstance;
13966
13979
 
13967
13980
  exports.InvalidAuthorization = InvalidAuthorization;
13968
13981
  exports.InvalidSubscription = InvalidSubscription;
13982
+ exports.NoTenantIdError = NoTenantIdError;
13969
13983
  exports.default = Auth$1;
@@ -2218,6 +2218,7 @@ class ApiRequester {
2218
2218
  /* */
2219
2219
 
2220
2220
  const DEFAULT_BACKEND_USER = 'wazo_user';
2221
+ const BACKEND_LDAP_USER = 'ldap_user';
2221
2222
  const DETAULT_EXPIRATION = 3600;
2222
2223
 
2223
2224
  var authMethods = (client , baseUrl ) => ({
@@ -13672,6 +13673,7 @@ const Wazo = {
13672
13673
  InvalidAuthorization,
13673
13674
  CanceledCallError,
13674
13675
  SFUNotAvailableError,
13676
+ NoTenantIdError,
13675
13677
  };
13676
13678
 
13677
13679
  if (window) {
@@ -13685,6 +13687,7 @@ if (global) {
13685
13687
 
13686
13688
  class InvalidSubscription extends Error {}
13687
13689
  class InvalidAuthorization extends Error {}
13690
+ class NoTenantIdError extends Error {}
13688
13691
 
13689
13692
  const logger = IssueReporter$1.loggerFor('simple-auth');
13690
13693
 
@@ -13698,11 +13701,15 @@ class Auth {
13698
13701
 
13699
13702
 
13700
13703
 
13704
+
13705
+
13701
13706
 
13702
13707
  constructor() {
13703
13708
  this.expiration = DETAULT_EXPIRATION;
13704
13709
  this.authenticated = false;
13705
13710
  this.minSubscriptionType = null;
13711
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
13712
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
13706
13713
  }
13707
13714
 
13708
13715
  init(clientId ,
@@ -13735,12 +13742,18 @@ class Auth {
13735
13742
  setFetchOptions(options);
13736
13743
  }
13737
13744
 
13738
- async logIn(username , password ) {
13745
+ async logIn(username , password , backend , tenantId ) {
13746
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
13747
+ throw new NoTenantIdError('No tenant id');
13748
+ }
13749
+
13739
13750
  this.authenticated = false;
13740
13751
  this.session = null;
13741
13752
  const rawSession = await getApiClient().auth.logIn({
13742
13753
  username,
13743
13754
  password,
13755
+ backend,
13756
+ tenantId,
13744
13757
  expiration: this.expiration,
13745
13758
  mobile: this.mobile,
13746
13759
  });
@@ -2821,6 +2821,7 @@ class Session {
2821
2821
  /* */
2822
2822
 
2823
2823
  const DEFAULT_BACKEND_USER = 'wazo_user';
2824
+ const BACKEND_LDAP_USER = 'ldap_user';
2824
2825
  const DETAULT_EXPIRATION = 3600;
2825
2826
 
2826
2827
  var authMethods = (client , baseUrl ) => ({
@@ -10387,6 +10388,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10387
10388
 
10388
10389
  class InvalidSubscription extends Error {}
10389
10390
  class InvalidAuthorization extends Error {}
10391
+ class NoTenantIdError extends Error {}
10390
10392
 
10391
10393
  const logger$7 = IssueReporter$1.loggerFor('simple-auth');
10392
10394
 
@@ -10400,11 +10402,15 @@ class Auth {
10400
10402
 
10401
10403
 
10402
10404
 
10405
+
10406
+
10403
10407
 
10404
10408
  constructor() {
10405
10409
  this.expiration = DETAULT_EXPIRATION;
10406
10410
  this.authenticated = false;
10407
10411
  this.minSubscriptionType = null;
10412
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
10413
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
10408
10414
  }
10409
10415
 
10410
10416
  init(clientId ,
@@ -10437,12 +10443,18 @@ class Auth {
10437
10443
  setFetchOptions(options);
10438
10444
  }
10439
10445
 
10440
- async logIn(username , password ) {
10446
+ async logIn(username , password , backend , tenantId ) {
10447
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
10448
+ throw new NoTenantIdError('No tenant id');
10449
+ }
10450
+
10441
10451
  this.authenticated = false;
10442
10452
  this.session = null;
10443
10453
  const rawSession = await getApiClient().auth.logIn({
10444
10454
  username,
10445
10455
  password,
10456
+ backend,
10457
+ tenantId,
10446
10458
  expiration: this.expiration,
10447
10459
  mobile: this.mobile,
10448
10460
  });
@@ -13543,6 +13555,7 @@ const Wazo = {
13543
13555
  InvalidAuthorization,
13544
13556
  CanceledCallError,
13545
13557
  SFUNotAvailableError,
13558
+ NoTenantIdError,
13546
13559
  };
13547
13560
 
13548
13561
  if (window) {
@@ -2218,6 +2218,7 @@ class ApiRequester {
2218
2218
  /* */
2219
2219
 
2220
2220
  const DEFAULT_BACKEND_USER = 'wazo_user';
2221
+ const BACKEND_LDAP_USER = 'ldap_user';
2221
2222
  const DETAULT_EXPIRATION = 3600;
2222
2223
 
2223
2224
  var authMethods = (client , baseUrl ) => ({
@@ -5619,6 +5620,7 @@ var getApiClient = (forServer ) => {
5619
5620
 
5620
5621
  class InvalidSubscription extends Error {}
5621
5622
  class InvalidAuthorization extends Error {}
5623
+ class NoTenantIdError extends Error {}
5622
5624
 
5623
5625
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5624
5626
 
@@ -5632,11 +5634,15 @@ class Auth {
5632
5634
 
5633
5635
 
5634
5636
 
5637
+
5638
+
5635
5639
 
5636
5640
  constructor() {
5637
5641
  this.expiration = DETAULT_EXPIRATION;
5638
5642
  this.authenticated = false;
5639
5643
  this.minSubscriptionType = null;
5644
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5645
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5640
5646
  }
5641
5647
 
5642
5648
  init(clientId ,
@@ -5669,12 +5675,18 @@ class Auth {
5669
5675
  setFetchOptions(options);
5670
5676
  }
5671
5677
 
5672
- async logIn(username , password ) {
5678
+ async logIn(username , password , backend , tenantId ) {
5679
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5680
+ throw new NoTenantIdError('No tenant id');
5681
+ }
5682
+
5673
5683
  this.authenticated = false;
5674
5684
  this.session = null;
5675
5685
  const rawSession = await getApiClient().auth.logIn({
5676
5686
  username,
5677
5687
  password,
5688
+ backend,
5689
+ tenantId,
5678
5690
  expiration: this.expiration,
5679
5691
  mobile: this.mobile,
5680
5692
  });
@@ -13953,6 +13965,7 @@ const Wazo = {
13953
13965
  InvalidAuthorization,
13954
13966
  CanceledCallError,
13955
13967
  SFUNotAvailableError,
13968
+ NoTenantIdError,
13956
13969
  };
13957
13970
 
13958
13971
  if (window) {
@@ -2244,6 +2244,7 @@ class Session {
2244
2244
  /* */
2245
2245
 
2246
2246
  const DEFAULT_BACKEND_USER = 'wazo_user';
2247
+ const BACKEND_LDAP_USER = 'ldap_user';
2247
2248
  const DETAULT_EXPIRATION = 3600;
2248
2249
 
2249
2250
  var authMethods = (client , baseUrl ) => ({
@@ -5619,6 +5620,7 @@ var getApiClient = (forServer ) => {
5619
5620
 
5620
5621
  class InvalidSubscription extends Error {}
5621
5622
  class InvalidAuthorization extends Error {}
5623
+ class NoTenantIdError extends Error {}
5622
5624
 
5623
5625
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5624
5626
 
@@ -5632,11 +5634,15 @@ class Auth {
5632
5634
 
5633
5635
 
5634
5636
 
5637
+
5638
+
5635
5639
 
5636
5640
  constructor() {
5637
5641
  this.expiration = DETAULT_EXPIRATION;
5638
5642
  this.authenticated = false;
5639
5643
  this.minSubscriptionType = null;
5644
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5645
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5640
5646
  }
5641
5647
 
5642
5648
  init(clientId ,
@@ -5669,12 +5675,18 @@ class Auth {
5669
5675
  setFetchOptions(options);
5670
5676
  }
5671
5677
 
5672
- async logIn(username , password ) {
5678
+ async logIn(username , password , backend , tenantId ) {
5679
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5680
+ throw new NoTenantIdError('No tenant id');
5681
+ }
5682
+
5673
5683
  this.authenticated = false;
5674
5684
  this.session = null;
5675
5685
  const rawSession = await getApiClient().auth.logIn({
5676
5686
  username,
5677
5687
  password,
5688
+ backend,
5689
+ tenantId,
5678
5690
  expiration: this.expiration,
5679
5691
  mobile: this.mobile,
5680
5692
  });
@@ -12822,6 +12834,7 @@ const Wazo = {
12822
12834
  InvalidAuthorization,
12823
12835
  CanceledCallError,
12824
12836
  SFUNotAvailableError,
12837
+ NoTenantIdError,
12825
12838
  };
12826
12839
 
12827
12840
  if (window) {
@@ -2244,6 +2244,7 @@ class Session {
2244
2244
  /* */
2245
2245
 
2246
2246
  const DEFAULT_BACKEND_USER = 'wazo_user';
2247
+ const BACKEND_LDAP_USER = 'ldap_user';
2247
2248
  const DETAULT_EXPIRATION = 3600;
2248
2249
 
2249
2250
  var authMethods = (client , baseUrl ) => ({
@@ -5619,6 +5620,7 @@ var getApiClient = (forServer ) => {
5619
5620
 
5620
5621
  class InvalidSubscription extends Error {}
5621
5622
  class InvalidAuthorization extends Error {}
5623
+ class NoTenantIdError extends Error {}
5622
5624
 
5623
5625
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5624
5626
 
@@ -5632,11 +5634,15 @@ class Auth {
5632
5634
 
5633
5635
 
5634
5636
 
5637
+
5638
+
5635
5639
 
5636
5640
  constructor() {
5637
5641
  this.expiration = DETAULT_EXPIRATION;
5638
5642
  this.authenticated = false;
5639
5643
  this.minSubscriptionType = null;
5644
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5645
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5640
5646
  }
5641
5647
 
5642
5648
  init(clientId ,
@@ -5669,12 +5675,18 @@ class Auth {
5669
5675
  setFetchOptions(options);
5670
5676
  }
5671
5677
 
5672
- async logIn(username , password ) {
5678
+ async logIn(username , password , backend , tenantId ) {
5679
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5680
+ throw new NoTenantIdError('No tenant id');
5681
+ }
5682
+
5673
5683
  this.authenticated = false;
5674
5684
  this.session = null;
5675
5685
  const rawSession = await getApiClient().auth.logIn({
5676
5686
  username,
5677
5687
  password,
5688
+ backend,
5689
+ tenantId,
5678
5690
  expiration: this.expiration,
5679
5691
  mobile: this.mobile,
5680
5692
  });
@@ -12827,6 +12839,7 @@ const Wazo = {
12827
12839
  InvalidAuthorization,
12828
12840
  CanceledCallError,
12829
12841
  SFUNotAvailableError,
12842
+ NoTenantIdError,
12830
12843
  };
12831
12844
 
12832
12845
  if (window) {
@@ -2218,6 +2218,7 @@ class Session {
2218
2218
  /* */
2219
2219
 
2220
2220
  const DEFAULT_BACKEND_USER = 'wazo_user';
2221
+ const BACKEND_LDAP_USER = 'ldap_user';
2221
2222
  const DETAULT_EXPIRATION = 3600;
2222
2223
 
2223
2224
  var authMethods = (client , baseUrl ) => ({
@@ -5619,6 +5620,7 @@ var getApiClient = (forServer ) => {
5619
5620
 
5620
5621
  class InvalidSubscription extends Error {}
5621
5622
  class InvalidAuthorization extends Error {}
5623
+ class NoTenantIdError extends Error {}
5622
5624
 
5623
5625
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5624
5626
 
@@ -5632,11 +5634,15 @@ class Auth {
5632
5634
 
5633
5635
 
5634
5636
 
5637
+
5638
+
5635
5639
 
5636
5640
  constructor() {
5637
5641
  this.expiration = DETAULT_EXPIRATION;
5638
5642
  this.authenticated = false;
5639
5643
  this.minSubscriptionType = null;
5644
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5645
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5640
5646
  }
5641
5647
 
5642
5648
  init(clientId ,
@@ -5669,12 +5675,18 @@ class Auth {
5669
5675
  setFetchOptions(options);
5670
5676
  }
5671
5677
 
5672
- async logIn(username , password ) {
5678
+ async logIn(username , password , backend , tenantId ) {
5679
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5680
+ throw new NoTenantIdError('No tenant id');
5681
+ }
5682
+
5673
5683
  this.authenticated = false;
5674
5684
  this.session = null;
5675
5685
  const rawSession = await getApiClient().auth.logIn({
5676
5686
  username,
5677
5687
  password,
5688
+ backend,
5689
+ tenantId,
5678
5690
  expiration: this.expiration,
5679
5691
  mobile: this.mobile,
5680
5692
  });
@@ -13106,6 +13118,7 @@ const Wazo = {
13106
13118
  InvalidAuthorization,
13107
13119
  CanceledCallError,
13108
13120
  SFUNotAvailableError,
13121
+ NoTenantIdError,
13109
13122
  };
13110
13123
 
13111
13124
  if (window) {
@@ -2220,6 +2220,7 @@ class Session {
2220
2220
  /* */
2221
2221
 
2222
2222
  const DEFAULT_BACKEND_USER = 'wazo_user';
2223
+ const BACKEND_LDAP_USER = 'ldap_user';
2223
2224
  const DETAULT_EXPIRATION = 3600;
2224
2225
 
2225
2226
  var authMethods = (client , baseUrl ) => ({
@@ -5621,6 +5622,7 @@ var getApiClient = (forServer ) => {
5621
5622
 
5622
5623
  class InvalidSubscription extends Error {}
5623
5624
  class InvalidAuthorization extends Error {}
5625
+ class NoTenantIdError extends Error {}
5624
5626
 
5625
5627
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5626
5628
 
@@ -5634,11 +5636,15 @@ class Auth {
5634
5636
 
5635
5637
 
5636
5638
 
5639
+
5640
+
5637
5641
 
5638
5642
  constructor() {
5639
5643
  this.expiration = DETAULT_EXPIRATION;
5640
5644
  this.authenticated = false;
5641
5645
  this.minSubscriptionType = null;
5646
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5647
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5642
5648
  }
5643
5649
 
5644
5650
  init(clientId ,
@@ -5671,12 +5677,18 @@ class Auth {
5671
5677
  setFetchOptions(options);
5672
5678
  }
5673
5679
 
5674
- async logIn(username , password ) {
5680
+ async logIn(username , password , backend , tenantId ) {
5681
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5682
+ throw new NoTenantIdError('No tenant id');
5683
+ }
5684
+
5675
5685
  this.authenticated = false;
5676
5686
  this.session = null;
5677
5687
  const rawSession = await getApiClient().auth.logIn({
5678
5688
  username,
5679
5689
  password,
5690
+ backend,
5691
+ tenantId,
5680
5692
  expiration: this.expiration,
5681
5693
  mobile: this.mobile,
5682
5694
  });
@@ -13119,6 +13131,7 @@ const Wazo = {
13119
13131
  InvalidAuthorization,
13120
13132
  CanceledCallError,
13121
13133
  SFUNotAvailableError,
13134
+ NoTenantIdError,
13122
13135
  };
13123
13136
 
13124
13137
  if (window) {