ngx-sp-auth 4.20.7 → 4.20.8

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.
@@ -5,10 +5,10 @@ import { HTTP_INTERCEPTORS, HttpClient, HttpHeaders, HttpParams } from '@angular
5
5
  import * as i1$2 from '@azure/msal-angular';
6
6
  import { MsalInterceptor, MsalGuard, MsalModule, MSAL_GUARD_CONFIG } from '@azure/msal-angular';
7
7
  import { LogLevel, PublicClientApplication, InteractionType } from '@azure/msal-browser';
8
+ import { BehaviorSubject, take, tap, firstValueFrom, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, map as map$1, of, lastValueFrom, from } from 'rxjs';
8
9
  import { take as take$1, tap as tap$1, map, switchMap as switchMap$1 } from 'rxjs/operators';
9
10
  import * as i1$1 from '@angular/router';
10
11
  import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
11
- import { BehaviorSubject, take, tap, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, map as map$1, firstValueFrom, of, lastValueFrom, from } from 'rxjs';
12
12
  import * as i3 from 'ngx-sp-infra';
13
13
  import { Utils, SearchInputComponent, InfraModule, FormUtils, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
14
14
  import { openDB, deleteDB } from 'idb';
@@ -1121,20 +1121,23 @@ class AuthService {
1121
1121
  // #region ==========> PROPERTIES <==========
1122
1122
  // #region PRIVATE
1123
1123
  this._pendingWarning = null;
1124
- this._BASE_URL = ''; // SpInfra2WS
1125
1124
  this._AUTH_BASE_URL = ''; // SpInfra2AuthWS
1125
+ this._BASE_URL = ''; // SpInfra2WS
1126
1126
  this._BASE_OS_URL = ''; // SpInfra2LoginWS
1127
+ this._LOGOUT_BASE_URL = ''; // SpInfra2LoginWS
1127
1128
  this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
1128
1129
  this.ip = "undefined";
1129
1130
  this.city = "undefined";
1130
1131
  this.state = "undefined";
1131
1132
  this.country = "undefined";
1132
- this._BASE_URL = `${this._customEnvironmentService.Sp2LocalhostInfra2LoginWS}/LoginSisproERP`; // SpInfra2WS
1133
1133
  this._AUTH_BASE_URL = `${this._customEnvironmentService.SpInfra2AuthWS}/Auth`; // SpInfra2AuthWS
1134
+ this._BASE_URL = `${this._customEnvironmentService.Sp2LocalhostInfra2LoginWS}/LoginSisproERP`; // SpInfra2WS
1134
1135
  this._BASE_OS_URL = `${this._customEnvironmentService.SpInfra2LoginWS}/LoginIntegradoOS`; // SpInfra2LoginWS
1135
- this._BASE_URL = !this._customEnvironmentService.production ? this._BASE_URL : `${this._customEnvironmentService.SpInfra2LoginWS}/LoginSisproERP`;
1136
+ this._LOGOUT_BASE_URL = `${this._customEnvironmentService.SpInfra2LoginWS}/LogoutSisproErp`; // SpInfra2LoginWS
1136
1137
  this._AUTH_BASE_URL = !this._customEnvironmentService.production ? this._AUTH_BASE_URL : `${this._customEnvironmentService.SpInfra2AuthWS}/Auth`;
1138
+ this._BASE_URL = !this._customEnvironmentService.production ? this._BASE_URL : `${this._customEnvironmentService.SpInfra2LoginWS}/LoginSisproERP`;
1137
1139
  this._BASE_OS_URL = !this._customEnvironmentService.production ? this._BASE_OS_URL : `${this._customEnvironmentService.SpInfra2LoginWS}/LoginIntegradoOS`;
1140
+ this._LOGOUT_BASE_URL = !this._customEnvironmentService.production ? this._BASE_OS_URL : `${this._customEnvironmentService.SpInfra2LoginWS}/LogoutSisproErp`;
1138
1141
  this.getParms();
1139
1142
  }
1140
1143
  // #region ==========> SERVICE METHODS <==========
@@ -1439,14 +1442,19 @@ class AuthService {
1439
1442
  }
1440
1443
  }));
1441
1444
  }
1442
- /** Realiza o logout do sistema, removendo tokens do localStorage e limpando cache */
1445
+ /** Realiza o logout do sistema, consumindo o endpoint de logout para remover os cookies e limpando as informações de autenticação armazenadas no localStorage. */
1443
1446
  logout() {
1444
- this._authStorageService.logout();
1445
- localStorage.removeItem('configsServerUser');
1446
- localStorage.removeItem('configsServerPassword');
1447
- // Método com customizações para inicializações do Logout
1448
- this._customLoginService.authLogout();
1449
- this._router.navigate(["/auth/login"]);
1447
+ // Consumo de endpoint de logout
1448
+ const url = `${this._LOGOUT_BASE_URL}`;
1449
+ firstValueFrom(this._httpClient.post(url, null, { 'headers': this._HTTP_HEADERS })).then(res => {
1450
+ console.log(res);
1451
+ this._authStorageService.logout();
1452
+ localStorage.removeItem('configsServerUser');
1453
+ localStorage.removeItem('configsServerPassword');
1454
+ // Método com customizações para inicializações do Logout
1455
+ this._customLoginService.authLogout();
1456
+ this._router.navigate(["/auth/login"]);
1457
+ });
1450
1458
  }
1451
1459
  validateAuthentication2Fa(code) {
1452
1460
  let Code2Fa = {