ngx-sp-auth 4.23.6 → 4.23.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.
@@ -830,7 +830,7 @@ class AuthStorageService {
830
830
  }
831
831
  verifyToken() {
832
832
  const url = `${this._BASE_VERIFICATION_URL}`;
833
- const headers = this._HTTP_HEADERS;
833
+ const headers = this._HTTP_HEADERS.set('x-application', this._customEnvironmentService.product);
834
834
  return defer(() => {
835
835
  this._toastr.info('Validando token do usuário.', 'Aguarde...', { timeOut: 3000, progressBar: true, progressAnimation: 'increasing', closeButton: true });
836
836
  const params = new HttpParams()
@@ -4704,7 +4704,7 @@ class LoginGuard {
4704
4704
  * @param route Rota atual
4705
4705
  * @param segments Segmentos.
4706
4706
  * @returns
4707
- */
4707
+ */
4708
4708
  canLoad(_route, _segments) {
4709
4709
  return this.authStorageService.checkAuthentication()
4710
4710
  .pipe(map(() => {
@@ -4714,6 +4714,15 @@ class LoginGuard {
4714
4714
  return true;
4715
4715
  }));
4716
4716
  }
4717
+ canMatch(_route, segments) {
4718
+ return this.authStorageService.checkAuthentication()
4719
+ .pipe(map(() => {
4720
+ if ((_route.path === "auth/login" && this.authStorageService.isLoggedInSub.value && !this.authStorageService.isExternalLogin)) {
4721
+ return this.router.createUrlTree(["/home"]);
4722
+ }
4723
+ return true;
4724
+ }));
4725
+ }
4717
4726
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LoginGuard, deps: [{ token: i1$1.Router }, { token: AuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4718
4727
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LoginGuard, providedIn: 'root' }); }
4719
4728
  }
@@ -4766,7 +4775,8 @@ class AuthAplicInterceptor {
4766
4775
  // Verifica se o Token precisa ser renovado
4767
4776
  // await this._authStorage.renewToken();
4768
4777
  // Adiciona as autenticações necessárias ao servidor.
4769
- changedReq = req.clone({ headers: req.headers, withCredentials: true });
4778
+ let clonedHeaders = req.headers.set('X-Application', this._customEnvironmentService.product);
4779
+ changedReq = req.clone({ headers: clonedHeaders, withCredentials: true });
4770
4780
  }
4771
4781
  // return await lastValueFrom(next.handle(changedReq));
4772
4782
  // Exemplo de leitura de resposta via interceptor abaixo:
@@ -4800,8 +4810,9 @@ class AuthInfraInterceptor {
4800
4810
  intercept(req, next) {
4801
4811
  let changedReq = req;
4802
4812
  if (this._authCheckService.needsAuthRequest(req.url, req.method, this._customEnvironmentService.needsAuthInfra)) {
4813
+ let clonedHeaders = req.headers.set('X-Application', this._customEnvironmentService.product);
4803
4814
  // Adiciona as autenticações necessárias ao servidor. Autenticação básica.
4804
- changedReq = req.clone({ headers: req.headers, withCredentials: true });
4815
+ changedReq = req.clone({ headers: clonedHeaders, withCredentials: true });
4805
4816
  }
4806
4817
  // return next.handle(changedReq);
4807
4818
  // Exemplo de leitura de resposta via interceptor abaixo: