Alfresco / alfresco-ng2-components

Alfresco Angular Components
https://www.alfresco.com/abn/adf/docs/
Apache License 2.0
293 stars 263 forks source link

[MNT-24628] Handle difference between config object and browser storage ticket #10270

Open tiagosalvado10 opened 2 days ago

tiagosalvado10 commented 2 days ago

Please check if the PR fulfills these requirements

  • [X] The commit message follows our guidelines
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • [X] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation
  • [ ] Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)

Following the steps from MNT-24628 we end up having different tickets in the client config object and browser local storage - where the ticket from config object is causing a 401 error. If the ticket from browser storage is used the request is successful.

What is the new behaviour?

The function AlfrescoApiClient.getAlfTicket(string) is now checking if tickets are different, if so, returns the ticket from browser storage and emits an event to initialize the API client and auth objects with the new ticket.

The second time the function is called, the config object will contain the correct ticket (i.e. equals to the storage one) and the request will work.

Does this PR introduce a breaking change? (check one with "x")

  • [ ] Yes
  • [X] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

Unit tests are still in progress.

sonarcloud[bot] commented 2 days ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud