ngx-sp-auth 4.23.1 → 4.23.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.
@@ -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, inject } from '@angular/core';
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';
@@ -512,82 +512,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
512
512
  }]
513
513
  }], ctorParameters: () => [{ type: LibCustomEnvironmentService }] });
514
514
 
515
- class LibCustomLoginService {
516
- constructor(_customLoginService) {
517
- this._customLoginService = _customLoginService;
518
- }
519
- // #region Propriedade Customizadas para o Componente login.component.ts
520
- get loginTitle() {
521
- return this._customLoginService.loginTitle;
522
- }
523
- get loginSubtitle() {
524
- return this._customLoginService.loginSubtitle;
525
- }
526
- get loginBackground() {
527
- return this._customLoginService.loginBackground;
528
- }
529
- get loginLogotipo() {
530
- return this._customLoginService.loginLogotipo;
531
- }
532
- get loginAltLogotipo() {
533
- return this._customLoginService.loginAltLogotipo;
534
- }
535
- get loginPageTitle() {
536
- return this._customLoginService.loginPageTitle;
537
- }
538
- get loginDesenvDomain() {
539
- return this._customLoginService.loginDesenvDomain;
540
- }
541
- get loginDesenvUser() {
542
- return this._customLoginService.loginDesenvUser;
543
- }
544
- get loginDesenvPassword() {
545
- return this._customLoginService.loginDesenvPassword;
546
- }
547
- // #endregion Propriedade Customizadas para o Componente login.component.ts
548
- // #region Métodos Customizadas para o Componente auth.service.ts
549
- /**
550
- * Método executado no auth.service.ts - método: login ()
551
- * Utilizado para inicializações diversas
552
- */
553
- authLogin() {
554
- this._customLoginService.authLogin();
555
- }
556
- /**
557
- * Método executado no auth.service.ts - método: logout ()
558
- * Utilizado para inicializações diversas
559
- */
560
- authLogout() {
561
- this._customLoginService.authLogout();
562
- }
563
- /**
564
- * Método executado no auth.service.ts - método: login ()
565
- * Utilizado para informar o redirecionamento para a tela inicial após o login ok
566
- *
567
- * @param router Objeto de Router que será utilizado
568
- */
569
- authNavigateToPage(router) {
570
- this._customLoginService.authNavigateToPage(router);
571
- }
572
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibCustomLoginService, deps: [{ token: LIB_CUSTOM_LOGIN_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
573
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibCustomLoginService, providedIn: 'root' }); }
574
- }
575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibCustomLoginService, decorators: [{
576
- type: Injectable,
577
- args: [{ providedIn: 'root' }]
578
- }], ctorParameters: () => [{ type: undefined, decorators: [{
579
- type: Inject,
580
- args: [LIB_CUSTOM_LOGIN_SERVICE]
581
- }] }] });
582
-
583
515
  class AuthStorageService {
584
- constructor(_httpBackend, _customStorageService, _indexedDBService, _customEnvironmentService, _customLoginService, _router) {
516
+ constructor(_httpBackend, _customStorageService, _indexedDBService, _customEnvironmentService,
517
+ // private _customLoginService: LibCustomLoginService,
518
+ _router) {
585
519
  this._httpBackend = _httpBackend;
586
520
  this._customStorageService = _customStorageService;
587
521
  this._indexedDBService = _indexedDBService;
588
522
  this._customEnvironmentService = _customEnvironmentService;
589
- this._customLoginService = _customLoginService;
590
523
  this._router = _router;
524
+ this._ipService = inject(IpServiceService);
591
525
  this._BASE_URL = ''; // SpInfra2LoginWS
592
526
  this._LOGOUT_BASE_URL = ''; // SpInfra2LoginWS
593
527
  this._BASE_VERIFICATION_URL = ''; // SpInfra2LoginWS
@@ -895,7 +829,10 @@ class AuthStorageService {
895
829
  verifyToken() {
896
830
  const url = `${this._BASE_VERIFICATION_URL}`;
897
831
  const headers = this._HTTP_HEADERS;
898
- return this._httpClient.get(url, { 'headers': headers, withCredentials: true })
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 })
899
836
  .pipe(take(1), tap(res => {
900
837
  if (res.Error)
901
838
  this.isLoggedInSub.next(false);
@@ -958,7 +895,7 @@ class AuthStorageService {
958
895
  localStorage.removeItem('configServerPassword');
959
896
  this.onLogout();
960
897
  // Método com customizações para inicializações do Logout
961
- this._customLoginService.authLogout();
898
+ // this._customLoginService.authLogout();
962
899
  });
963
900
  return this._router.navigate(["/auth/login"]);
964
901
  }
@@ -1065,13 +1002,81 @@ class AuthStorageService {
1065
1002
  return false;
1066
1003
  }
1067
1004
  }
1068
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthStorageService, deps: [{ token: i1.HttpBackend }, { token: LibCustomStorageService }, { token: IndexedDBService }, { token: LibCustomEnvironmentService }, { token: LibCustomLoginService }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
1005
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthStorageService, deps: [{ token: i1.HttpBackend }, { token: LibCustomStorageService }, { token: IndexedDBService }, { token: LibCustomEnvironmentService }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
1069
1006
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthStorageService, providedIn: 'root' }); }
1070
1007
  }
1071
1008
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthStorageService, decorators: [{
1072
1009
  type: Injectable,
1073
1010
  args: [{ providedIn: 'root' }]
1074
- }], ctorParameters: () => [{ type: i1.HttpBackend }, { type: LibCustomStorageService }, { type: IndexedDBService }, { type: LibCustomEnvironmentService }, { type: LibCustomLoginService }, { type: i1$1.Router }] });
1011
+ }], ctorParameters: () => [{ type: i1.HttpBackend }, { type: LibCustomStorageService }, { type: IndexedDBService }, { type: LibCustomEnvironmentService }, { type: i1$1.Router }] });
1012
+
1013
+ class LibCustomLoginService {
1014
+ constructor(_customLoginService) {
1015
+ this._customLoginService = _customLoginService;
1016
+ }
1017
+ // #region Propriedade Customizadas para o Componente login.component.ts
1018
+ get loginTitle() {
1019
+ return this._customLoginService.loginTitle;
1020
+ }
1021
+ get loginSubtitle() {
1022
+ return this._customLoginService.loginSubtitle;
1023
+ }
1024
+ get loginBackground() {
1025
+ return this._customLoginService.loginBackground;
1026
+ }
1027
+ get loginLogotipo() {
1028
+ return this._customLoginService.loginLogotipo;
1029
+ }
1030
+ get loginAltLogotipo() {
1031
+ return this._customLoginService.loginAltLogotipo;
1032
+ }
1033
+ get loginPageTitle() {
1034
+ return this._customLoginService.loginPageTitle;
1035
+ }
1036
+ get loginDesenvDomain() {
1037
+ return this._customLoginService.loginDesenvDomain;
1038
+ }
1039
+ get loginDesenvUser() {
1040
+ return this._customLoginService.loginDesenvUser;
1041
+ }
1042
+ get loginDesenvPassword() {
1043
+ return this._customLoginService.loginDesenvPassword;
1044
+ }
1045
+ // #endregion Propriedade Customizadas para o Componente login.component.ts
1046
+ // #region Métodos Customizadas para o Componente auth.service.ts
1047
+ /**
1048
+ * Método executado no auth.service.ts - método: login ()
1049
+ * Utilizado para inicializações diversas
1050
+ */
1051
+ authLogin() {
1052
+ this._customLoginService.authLogin();
1053
+ }
1054
+ /**
1055
+ * Método executado no auth.service.ts - método: logout ()
1056
+ * Utilizado para inicializações diversas
1057
+ */
1058
+ authLogout() {
1059
+ this._customLoginService.authLogout();
1060
+ }
1061
+ /**
1062
+ * Método executado no auth.service.ts - método: login ()
1063
+ * Utilizado para informar o redirecionamento para a tela inicial após o login ok
1064
+ *
1065
+ * @param router Objeto de Router que será utilizado
1066
+ */
1067
+ authNavigateToPage(router) {
1068
+ this._customLoginService.authNavigateToPage(router);
1069
+ }
1070
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibCustomLoginService, deps: [{ token: LIB_CUSTOM_LOGIN_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
1071
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibCustomLoginService, providedIn: 'root' }); }
1072
+ }
1073
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibCustomLoginService, decorators: [{
1074
+ type: Injectable,
1075
+ args: [{ providedIn: 'root' }]
1076
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1077
+ type: Inject,
1078
+ args: [LIB_CUSTOM_LOGIN_SERVICE]
1079
+ }] }] });
1075
1080
 
1076
1081
  class AuthUtilService {
1077
1082
  constructor(_authStorageService, _checkUrlAndMethodService, _customEnvironmentService, _message, _router) {
@@ -4512,6 +4517,12 @@ class AuthGuard {
4512
4517
  return true;
4513
4518
  }));
4514
4519
  }
4520
+ canMatch(_route, segments) {
4521
+ if (segments[0]?.path.toLowerCase() === 'auth') {
4522
+ return of(false);
4523
+ }
4524
+ return this.IsUserAuth();
4525
+ }
4515
4526
  canActivate(_route, _state) {
4516
4527
  return this.IsUserAuth();
4517
4528
  }
@@ -4734,9 +4745,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
4734
4745
  * Depende do serviço de autenticação.
4735
4746
  */
4736
4747
  class AuthAplicInterceptor {
4737
- constructor(_authCheckService, _authStorage, _customEnvironmentService) {
4748
+ constructor(_authCheckService, _customEnvironmentService) {
4738
4749
  this._authCheckService = _authCheckService;
4739
- this._authStorage = _authStorage;
4740
4750
  this._customEnvironmentService = _customEnvironmentService;
4741
4751
  }
4742
4752
  intercept(req, next) {
@@ -4766,13 +4776,13 @@ class AuthAplicInterceptor {
4766
4776
  return throwError(() => error);
4767
4777
  })));
4768
4778
  }
4769
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthAplicInterceptor, deps: [{ token: i3.CheckUrlAndMethodService }, { token: AuthStorageService }, { token: LibCustomEnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4779
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthAplicInterceptor, deps: [{ token: i3.CheckUrlAndMethodService }, { token: LibCustomEnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4770
4780
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthAplicInterceptor, providedIn: 'root' }); }
4771
4781
  }
4772
4782
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AuthAplicInterceptor, decorators: [{
4773
4783
  type: Injectable,
4774
4784
  args: [{ providedIn: 'root' }]
4775
- }], ctorParameters: () => [{ type: i3.CheckUrlAndMethodService }, { type: AuthStorageService }, { type: LibCustomEnvironmentService }] });
4785
+ }], ctorParameters: () => [{ type: i3.CheckUrlAndMethodService }, { type: LibCustomEnvironmentService }] });
4776
4786
 
4777
4787
  /** Intercepta uma chamada HTTP para inserir a autenticação da básica das APIs nos Cookies (e no header, para compatibilidade) */
4778
4788
  class AuthInfraInterceptor {