ngx-sp-auth 4.23.2 → 4.23.4
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/fesm2022/ngx-sp-auth.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { importProvidersFrom, NgModule, InjectionToken, Inject, Injectable, ViewContainerRef, ViewChild, Component, EventEmitter, Output, Input, TemplateRef, ContentChild
|
|
2
|
+
import { importProvidersFrom, NgModule, InjectionToken, Inject, Injectable, inject, ViewContainerRef, ViewChild, Component, EventEmitter, Output, Input, TemplateRef, ContentChild } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common/http';
|
|
4
4
|
import { HTTP_INTERCEPTORS, HttpHeaders, HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
|
|
5
5
|
import * as i1$2 from '@azure/msal-angular';
|
|
@@ -9,9 +9,9 @@ import { take as take$1, tap as tap$1, map as map$1, switchMap as switchMap$1 }
|
|
|
9
9
|
import * as i1$1 from '@angular/router';
|
|
10
10
|
import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
|
|
11
11
|
import { BehaviorSubject, map, catchError, of, finalize, shareReplay, take, tap, firstValueFrom, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, lastValueFrom, from, throwError } from 'rxjs';
|
|
12
|
-
import { openDB, deleteDB } from 'idb';
|
|
13
12
|
import * as i3 from 'ngx-sp-infra';
|
|
14
|
-
import { Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
|
|
13
|
+
import { IpServiceService, Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
|
|
14
|
+
import { openDB, deleteDB } from 'idb';
|
|
15
15
|
import * as i17 from '@angular/common';
|
|
16
16
|
import { NgIf, CommonModule, NgClass } from '@angular/common';
|
|
17
17
|
import * as i7 from '@angular/forms';
|
|
@@ -521,6 +521,7 @@ class AuthStorageService {
|
|
|
521
521
|
this._indexedDBService = _indexedDBService;
|
|
522
522
|
this._customEnvironmentService = _customEnvironmentService;
|
|
523
523
|
this._router = _router;
|
|
524
|
+
this._ipService = inject(IpServiceService);
|
|
524
525
|
this._BASE_URL = ''; // SpInfra2LoginWS
|
|
525
526
|
this._LOGOUT_BASE_URL = ''; // SpInfra2LoginWS
|
|
526
527
|
this._BASE_VERIFICATION_URL = ''; // SpInfra2LoginWS
|
|
@@ -828,7 +829,10 @@ class AuthStorageService {
|
|
|
828
829
|
verifyToken() {
|
|
829
830
|
const url = `${this._BASE_VERIFICATION_URL}`;
|
|
830
831
|
const headers = this._HTTP_HEADERS;
|
|
831
|
-
|
|
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 })
|
|
832
836
|
.pipe(take(1), tap(res => {
|
|
833
837
|
if (res.Error)
|
|
834
838
|
this.isLoggedInSub.next(false);
|
|
@@ -1248,7 +1252,7 @@ class AuthService {
|
|
|
1248
1252
|
const url = `${this._AUTH_BASE_URL}/GetAuthentication`;
|
|
1249
1253
|
const headers = this._HTTP_HEADERS;
|
|
1250
1254
|
return this._httpClient
|
|
1251
|
-
.post(url, null, { 'params': params, 'headers': headers })
|
|
1255
|
+
.post(url, null, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1252
1256
|
.pipe(take$1(1), tap$1((response) => {
|
|
1253
1257
|
if (response.Error) {
|
|
1254
1258
|
throw Error(response.ErrorMessage);
|
|
@@ -1288,7 +1292,7 @@ class AuthService {
|
|
|
1288
1292
|
const url = `${this._BASE_URL}/ValidateLogin`;
|
|
1289
1293
|
const headers = this._HTTP_HEADERS;
|
|
1290
1294
|
return this._httpClient
|
|
1291
|
-
.post(url, login, { 'params': params, 'headers': headers })
|
|
1295
|
+
.post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1292
1296
|
.pipe(take$1(1), tap$1((response) => {
|
|
1293
1297
|
// Limnpa o armazenamento local do navegador que contém os filtros de um produto específico (com base na prop 'product' do environment)
|
|
1294
1298
|
this._indexedDBService.closeOpenConnection()
|
|
@@ -1368,7 +1372,7 @@ class AuthService {
|
|
|
1368
1372
|
const url = `${this._BASE_URL}/ValidateLogin`;
|
|
1369
1373
|
const headers = this._HTTP_HEADERS;
|
|
1370
1374
|
return this._httpClient
|
|
1371
|
-
.post(url, login, { 'params': params, 'headers': headers })
|
|
1375
|
+
.post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1372
1376
|
.pipe(take$1(1), tap$1((response) => {
|
|
1373
1377
|
if (response.FeedbackMessage != "") {
|
|
1374
1378
|
return;
|
|
@@ -1412,7 +1416,7 @@ class AuthService {
|
|
|
1412
1416
|
const url = `${this._BASE_URL}/ValidateExternalLogin`;
|
|
1413
1417
|
const headers = this._HTTP_HEADERS;
|
|
1414
1418
|
return this._httpClient
|
|
1415
|
-
.post(url, login, { 'params': params, 'headers': headers })
|
|
1419
|
+
.post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1416
1420
|
.pipe(take$1(1), tap$1((response) => {
|
|
1417
1421
|
if (!response.Error) {
|
|
1418
1422
|
this._authStorageService.isLoggedInSub.next(true);
|
|
@@ -1458,7 +1462,7 @@ class AuthService {
|
|
|
1458
1462
|
const url = `${this._BASE_OS_URL}/ValidateOSLogin`;
|
|
1459
1463
|
const headers = this._HTTP_HEADERS;
|
|
1460
1464
|
return this._httpClient
|
|
1461
|
-
.post(url, login, { 'params': params, 'headers': headers })
|
|
1465
|
+
.post(url, login, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1462
1466
|
.pipe(take$1(1), tap$1((response) => {
|
|
1463
1467
|
if (response.FeedbackMessage != "" && response.FeedbackMessage != null) {
|
|
1464
1468
|
return;
|
|
@@ -1512,7 +1516,7 @@ class AuthService {
|
|
|
1512
1516
|
const url = `${this._BASE_URL}/ValidadeLogin2FaWithEmail`;
|
|
1513
1517
|
const headers = this._HTTP_HEADERS;
|
|
1514
1518
|
return this._httpClient
|
|
1515
|
-
.post(url, Code2Fa, { 'params': params, 'headers': headers })
|
|
1519
|
+
.post(url, Code2Fa, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1516
1520
|
.pipe(take$1(1), tap$1((response) => {
|
|
1517
1521
|
if (response.Error) {
|
|
1518
1522
|
throw Error(response.ErrorMessage);
|
|
@@ -1553,7 +1557,7 @@ class AuthService {
|
|
|
1553
1557
|
const url = `${this._BASE_URL}/GetNewCode2FaWithEmail`;
|
|
1554
1558
|
const headers = this._HTTP_HEADERS;
|
|
1555
1559
|
return this._httpClient
|
|
1556
|
-
.post(url, null, { 'params': params, 'headers': headers })
|
|
1560
|
+
.post(url, null, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1557
1561
|
.pipe(take$1(1), tap$1((response) => {
|
|
1558
1562
|
if (response.Error) {
|
|
1559
1563
|
throw Error(response.ErrorMessage);
|
|
@@ -1572,7 +1576,7 @@ class AuthService {
|
|
|
1572
1576
|
const headers = this._HTTP_HEADERS;
|
|
1573
1577
|
const url = `${this._BASE_URL}/ForgottenPassword`;
|
|
1574
1578
|
return this._httpClient
|
|
1575
|
-
.post(url, null, { 'params': params, 'headers': headers })
|
|
1579
|
+
.post(url, null, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1576
1580
|
.pipe(take$1(1), tap$1((response) => {
|
|
1577
1581
|
if (response.Error) {
|
|
1578
1582
|
throw Error(response.ErrorMessage);
|
|
@@ -1591,7 +1595,7 @@ class AuthService {
|
|
|
1591
1595
|
const headers = this._HTTP_HEADERS;
|
|
1592
1596
|
const url = `${this._BASE_URL}/RecoverPassword`;
|
|
1593
1597
|
return this._httpClient
|
|
1594
|
-
.post(url, recupPassword, { 'params': params, 'headers': headers })
|
|
1598
|
+
.post(url, recupPassword, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1595
1599
|
.pipe(take$1(1), tap$1((response) => {
|
|
1596
1600
|
if (response.Error) {
|
|
1597
1601
|
throw Error(response.ErrorMessage);
|
|
@@ -1610,7 +1614,7 @@ class AuthService {
|
|
|
1610
1614
|
const headers = this._HTTP_HEADERS;
|
|
1611
1615
|
const url = `${this._BASE_URL}/CreatePassword`;
|
|
1612
1616
|
return this._httpClient
|
|
1613
|
-
.post(url, recupPassword, { 'params': params, 'headers': headers })
|
|
1617
|
+
.post(url, recupPassword, { 'params': params, 'headers': headers, withCredentials: true })
|
|
1614
1618
|
.pipe(take$1(1), tap$1((response) => {
|
|
1615
1619
|
if (response.Error) {
|
|
1616
1620
|
throw Error(response.ErrorMessage);
|
|
@@ -4513,6 +4517,12 @@ class AuthGuard {
|
|
|
4513
4517
|
return true;
|
|
4514
4518
|
}));
|
|
4515
4519
|
}
|
|
4520
|
+
canMatch(_route, segments) {
|
|
4521
|
+
if (segments[0]?.path.toLowerCase() === 'auth') {
|
|
4522
|
+
return of(false);
|
|
4523
|
+
}
|
|
4524
|
+
return this.IsUserAuth();
|
|
4525
|
+
}
|
|
4516
4526
|
canActivate(_route, _state) {
|
|
4517
4527
|
return this.IsUserAuth();
|
|
4518
4528
|
}
|