ngx-sp-auth 4.22.13 → 4.22.15

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.
@@ -897,7 +897,6 @@ class AuthStorageService {
897
897
  const headers = this._HTTP_HEADERS;
898
898
  return this._httpClient.get(url, { 'headers': headers, withCredentials: true })
899
899
  .pipe(take(1), tap(res => {
900
- console.log(res);
901
900
  if (res.Error)
902
901
  this.isLoggedInSub.next(false);
903
902
  else
@@ -949,25 +948,18 @@ class AuthStorageService {
949
948
  async logout() {
950
949
  // Consumo de endpoint de logout
951
950
  const url = `${this._LOGOUT_BASE_URL}`;
952
- console.log('1. URL:', url);
953
- await firstValueFrom(this._httpClient.post(url, null, { 'headers': this._HTTP_HEADERS, withCredentials: true })).then((res) => {
954
- console.log('2. res:', res);
955
- })
951
+ await firstValueFrom(this._httpClient.post(url, null, { 'headers': this._HTTP_HEADERS, withCredentials: true })).then((res) => { })
956
952
  .catch((err) => {
957
- console.log('2.1. teste se aparece aqui no erro do endpoint de logout:', err);
953
+ console.error(err);
958
954
  })
959
955
  .then(() => {
960
956
  // Independente de sucesso ou erro, realiza a limpeza do localStorage após o endpoint ser chamado
961
- console.log('3. Removendo variáveis de configuração do usuário e senha do localStorage');
962
957
  localStorage.removeItem('configServerUser');
963
958
  localStorage.removeItem('configServerPassword');
964
- console.log('4. Chamando método onLogout() para limpar variáveis de autenticação e redirecionar para a tela de login');
965
959
  this.onLogout();
966
960
  // Método com customizações para inicializações do Logout
967
- console.log('5. Chamando método authLogout() do serviço de customização para realizar ações de logout específicas');
968
961
  this._customLoginService.authLogout();
969
962
  });
970
- console.log('6. Navegando para rota de login');
971
963
  return this._router.navigate(["/auth/login"]);
972
964
  }
973
965
  getNewTokenBack() {
@@ -1026,7 +1018,6 @@ class AuthStorageService {
1026
1018
  // }
1027
1019
  // }
1028
1020
  onLogout() {
1029
- console.log('4.1. Iniciando onLogout() para limpar variáveis de autenticação e redirecionar para a tela de login');
1030
1021
  this.__isCheckingAuth = false;
1031
1022
  this.__authenticationCheck$ = null;
1032
1023
  this.isLoggedInSub.next(false);
@@ -1049,7 +1040,6 @@ class AuthStorageService {
1049
1040
  this.__is2FaEnabled = false;
1050
1041
  this.__azureTenantId = "";
1051
1042
  this.__azureClientId = "";
1052
- console.log('4.2. __localKey:', this.__local_key);
1053
1043
  localStorage.removeItem(this.__local_key);
1054
1044
  // Limpa o armazenamento local do navegador que contém os filtros de um produto específico
1055
1045
  // Fecha a conexão local (se houver) antes de excluir a database para evitar o callback 'blocking'
@@ -1661,7 +1651,7 @@ class MenuServicesService {
1661
1651
  // #region NewImg Event
1662
1652
  // Implementação de lógica vista no link: https://hasangalakdinu.medium.com/how-to-call-a-function-in-another-component-angular-using-rxjs-3f2e85920705
1663
1653
  this._subject = new Subject();
1664
- this._BASE_URL = `${this._customEnvironmentService.Sp2LocalhostWS}`; // SpInfra2ErpWS
1654
+ this._BASE_URL = `${this._customEnvironmentService.SpInfra2ErpWS}`; // SpInfra2ErpWS
1665
1655
  this._BASE_URL = !this._customEnvironmentService.production ? this._BASE_URL : `${this._customEnvironmentService.SpInfra2ErpWS}`;
1666
1656
  this._BASE_URL_VERSION_INFRA = `${this._customEnvironmentService.SpInfra2AuthWS.replace('SpInfra2AuthWS', 'SpInfra2VersionWS')}`; // SpInfra2VersionWS
1667
1657
  this._BASE_URL_VERSION_INFRA = !this._customEnvironmentService.production ? this._BASE_URL_VERSION_INFRA : `${this._customEnvironmentService.SpInfra2AuthWS.replace('SpInfra2AuthWS', 'SpInfra2VersionWS')}`;
@@ -4760,8 +4750,6 @@ class AuthAplicInterceptor {
4760
4750
  // Verifica se o Token precisa ser renovado
4761
4751
  // await this._authStorage.renewToken();
4762
4752
  // Adiciona as autenticações necessárias ao servidor.
4763
- // Daqui alguns dias este trecho será removido e os tokens serão enviados exclusivamente pelos Cookies, mas por enquanto, para manter compatibilidade com o que já existe, o token será enviado no header
4764
- // let headers: HttpHeaders = req.headers.set('Authorization', `Bearer ${this._authStorage.authToken}`);
4765
4753
  changedReq = req.clone({ headers: req.headers, withCredentials: true });
4766
4754
  }
4767
4755
  // return await lastValueFrom(next.handle(changedReq));
@@ -4796,18 +4784,8 @@ class AuthInfraInterceptor {
4796
4784
  intercept(req, next) {
4797
4785
  let changedReq = req;
4798
4786
  if (this._authCheckService.needsAuthRequest(req.url, req.method, this._customEnvironmentService.needsAuthInfra)) {
4799
- // Instanciado inicialmente com os headers da requisição original, para não perder nenhum header que já tenha sido adicionado
4800
- let headers = req.headers;
4801
4787
  // Adiciona as autenticações necessárias ao servidor. Autenticação básica.
4802
- // Daqui alguns dias este trecho será removido e os tokens serão enviados exclusivamente pelos Cookies, mas por enquanto, para manter compatibilidade com o que já existe, o token será enviado no header
4803
- if (localStorage.getItem('configServerUser') && localStorage.getItem('configServerPassword')) {
4804
- headers = req.headers.set("Authorization", `Basic ${btoa(`${localStorage.getItem('configServerUser')}:${localStorage.getItem('configServerPassword')}`)}
4805
- `);
4806
- }
4807
- changedReq = req.clone({
4808
- headers: req.headers,
4809
- withCredentials: true // Parâmetro necessário para utilização dos Cookies HttpOnly
4810
- });
4788
+ changedReq = req.clone({ headers: req.headers, withCredentials: true });
4811
4789
  }
4812
4790
  // return next.handle(changedReq);
4813
4791
  // Exemplo de leitura de resposta via interceptor abaixo:
@@ -4815,12 +4793,12 @@ class AuthInfraInterceptor {
4815
4793
  // INTERCEPTAR RESPOSTA
4816
4794
  .pipe(tap(event => {
4817
4795
  if (event instanceof HttpResponse) {
4818
- console.log("Resposta HTTP interceptada:", event);
4796
+ // console.log("Resposta HTTP interceptada:", event);
4819
4797
  }
4820
4798
  }),
4821
4799
  // INTERCEPTAR ERRO
4822
4800
  catchError(error => {
4823
- console.error("Erro HTTP interceptado:", error);
4801
+ // console.error("Erro HTTP interceptado:", error);
4824
4802
  return throwError(() => error);
4825
4803
  }));
4826
4804
  }