ngx-sp-auth 4.23.3 → 4.23.5

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.
@@ -8,9 +8,9 @@ import { LogLevel, PublicClientApplication, InteractionType } from '@azure/msal-
8
8
  import { take as take$1, tap as tap$1, map as map$1, switchMap as switchMap$1 } from 'rxjs/operators';
9
9
  import * as i1$1 from '@angular/router';
10
10
  import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
11
- import { BehaviorSubject, map, catchError, of, finalize, shareReplay, take, tap, firstValueFrom, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, lastValueFrom, from, throwError } from 'rxjs';
11
+ import { BehaviorSubject, map, catchError, of, finalize, shareReplay, defer, take, tap, firstValueFrom, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, lastValueFrom, from, throwError } from 'rxjs';
12
12
  import * as i3 from 'ngx-sp-infra';
13
- import { IpServiceService, Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
13
+ import { IpServiceService, GlobalLoadingService, Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
14
14
  import { openDB, deleteDB } from 'idb';
15
15
  import * as i17 from '@angular/common';
16
16
  import { NgIf, CommonModule, NgClass } from '@angular/common';
@@ -522,6 +522,7 @@ class AuthStorageService {
522
522
  this._customEnvironmentService = _customEnvironmentService;
523
523
  this._router = _router;
524
524
  this._ipService = inject(IpServiceService);
525
+ this._globalLoadingService = inject(GlobalLoadingService);
525
526
  this._BASE_URL = ''; // SpInfra2LoginWS
526
527
  this._LOGOUT_BASE_URL = ''; // SpInfra2LoginWS
527
528
  this._BASE_VERIFICATION_URL = ''; // SpInfra2LoginWS
@@ -829,16 +830,19 @@ class AuthStorageService {
829
830
  verifyToken() {
830
831
  const url = `${this._BASE_VERIFICATION_URL}`;
831
832
  const headers = this._HTTP_HEADERS;
832
- const params = new HttpParams()
833
- .set('ip', this.ip)
834
- .set('browser', this._ipService.getDataBrowserUser().browser);
835
- return this._httpClient.get(url, { params, 'headers': headers, withCredentials: true })
836
- .pipe(take(1), tap(res => {
837
- if (res.Error)
838
- this.isLoggedInSub.next(false);
839
- else
840
- this.isLoggedInSub.next(true);
841
- }));
833
+ return defer(() => {
834
+ this._globalLoadingService.show(false, 'Validando token do usuário.');
835
+ const params = new HttpParams()
836
+ .set('ip', this.ip)
837
+ .set('browser', this._ipService.getDataBrowserUser().browser);
838
+ return this._httpClient.get(url, { params, 'headers': headers, withCredentials: true })
839
+ .pipe(take(1), tap(res => {
840
+ if (res.Error)
841
+ this.isLoggedInSub.next(false);
842
+ else
843
+ this.isLoggedInSub.next(true);
844
+ }));
845
+ }).pipe(finalize(() => this._globalLoadingService.hide()));
842
846
  }
843
847
  /** Verifica a cada diferença de tempo entre a data atual e a data do token. */
844
848
  // public async reCheckLogin(renew: boolean) {
@@ -1252,7 +1256,7 @@ class AuthService {
1252
1256
  const url = `${this._AUTH_BASE_URL}/GetAuthentication`;
1253
1257
  const headers = this._HTTP_HEADERS;
1254
1258
  return this._httpClient
1255
- .post(url, null, { 'params': params, 'headers': headers })
1259
+ .post(url, null, { 'params': params, 'headers': headers, withCredentials: true })
1256
1260
  .pipe(take$1(1), tap$1((response) => {
1257
1261
  if (response.Error) {
1258
1262
  throw Error(response.ErrorMessage);
@@ -1292,7 +1296,7 @@ class AuthService {
1292
1296
  const url = `${this._BASE_URL}/ValidateLogin`;
1293
1297
  const headers = this._HTTP_HEADERS;
1294
1298
  return this._httpClient
1295
- .post(url, login, { 'params': params, 'headers': headers })
1299
+ .post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
1296
1300
  .pipe(take$1(1), tap$1((response) => {
1297
1301
  // Limnpa o armazenamento local do navegador que contém os filtros de um produto específico (com base na prop 'product' do environment)
1298
1302
  this._indexedDBService.closeOpenConnection()
@@ -1372,7 +1376,7 @@ class AuthService {
1372
1376
  const url = `${this._BASE_URL}/ValidateLogin`;
1373
1377
  const headers = this._HTTP_HEADERS;
1374
1378
  return this._httpClient
1375
- .post(url, login, { 'params': params, 'headers': headers })
1379
+ .post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
1376
1380
  .pipe(take$1(1), tap$1((response) => {
1377
1381
  if (response.FeedbackMessage != "") {
1378
1382
  return;
@@ -1416,7 +1420,7 @@ class AuthService {
1416
1420
  const url = `${this._BASE_URL}/ValidateExternalLogin`;
1417
1421
  const headers = this._HTTP_HEADERS;
1418
1422
  return this._httpClient
1419
- .post(url, login, { 'params': params, 'headers': headers })
1423
+ .post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
1420
1424
  .pipe(take$1(1), tap$1((response) => {
1421
1425
  if (!response.Error) {
1422
1426
  this._authStorageService.isLoggedInSub.next(true);
@@ -1462,7 +1466,7 @@ class AuthService {
1462
1466
  const url = `${this._BASE_OS_URL}/ValidateOSLogin`;
1463
1467
  const headers = this._HTTP_HEADERS;
1464
1468
  return this._httpClient
1465
- .post(url, login, { 'params': params, 'headers': headers })
1469
+ .post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
1466
1470
  .pipe(take$1(1), tap$1((response) => {
1467
1471
  if (response.FeedbackMessage != "" && response.FeedbackMessage != null) {
1468
1472
  return;
@@ -1516,7 +1520,7 @@ class AuthService {
1516
1520
  const url = `${this._BASE_URL}/ValidadeLogin2FaWithEmail`;
1517
1521
  const headers = this._HTTP_HEADERS;
1518
1522
  return this._httpClient
1519
- .post(url, Code2Fa, { 'params': params, 'headers': headers })
1523
+ .post(url, Code2Fa, { 'params': params, 'headers': headers, withCredentials: true })
1520
1524
  .pipe(take$1(1), tap$1((response) => {
1521
1525
  if (response.Error) {
1522
1526
  throw Error(response.ErrorMessage);
@@ -1557,7 +1561,7 @@ class AuthService {
1557
1561
  const url = `${this._BASE_URL}/GetNewCode2FaWithEmail`;
1558
1562
  const headers = this._HTTP_HEADERS;
1559
1563
  return this._httpClient
1560
- .post(url, null, { 'params': params, 'headers': headers })
1564
+ .post(url, null, { 'params': params, 'headers': headers, withCredentials: true })
1561
1565
  .pipe(take$1(1), tap$1((response) => {
1562
1566
  if (response.Error) {
1563
1567
  throw Error(response.ErrorMessage);
@@ -1576,7 +1580,7 @@ class AuthService {
1576
1580
  const headers = this._HTTP_HEADERS;
1577
1581
  const url = `${this._BASE_URL}/ForgottenPassword`;
1578
1582
  return this._httpClient
1579
- .post(url, null, { 'params': params, 'headers': headers })
1583
+ .post(url, null, { 'params': params, 'headers': headers, withCredentials: true })
1580
1584
  .pipe(take$1(1), tap$1((response) => {
1581
1585
  if (response.Error) {
1582
1586
  throw Error(response.ErrorMessage);
@@ -1595,7 +1599,7 @@ class AuthService {
1595
1599
  const headers = this._HTTP_HEADERS;
1596
1600
  const url = `${this._BASE_URL}/RecoverPassword`;
1597
1601
  return this._httpClient
1598
- .post(url, recupPassword, { 'params': params, 'headers': headers })
1602
+ .post(url, recupPassword, { 'params': params, 'headers': headers, withCredentials: true })
1599
1603
  .pipe(take$1(1), tap$1((response) => {
1600
1604
  if (response.Error) {
1601
1605
  throw Error(response.ErrorMessage);
@@ -1614,7 +1618,7 @@ class AuthService {
1614
1618
  const headers = this._HTTP_HEADERS;
1615
1619
  const url = `${this._BASE_URL}/CreatePassword`;
1616
1620
  return this._httpClient
1617
- .post(url, recupPassword, { 'params': params, 'headers': headers })
1621
+ .post(url, recupPassword, { 'params': params, 'headers': headers, withCredentials: true })
1618
1622
  .pipe(take$1(1), tap$1((response) => {
1619
1623
  if (response.Error) {
1620
1624
  throw Error(response.ErrorMessage);