Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DUPLO-13529 Detect token invalidation from user logout #23

Merged
merged 7 commits into from
Dec 21, 2023

Conversation

duplodavid
Copy link
Contributor

Change description

Fixes an issue in which the logic continued to attempt to use a Duplo token that was preemptively invalidated by the user logging out of the web portal. This condition is now checked beforehand and a new token retrieved if necessary.

Adds AdminGetInfrastructure to api.go which can be used to perform a Duplo token validating test call. This API is called in a new function PingDuploCreds used at the time a Duplo token is read from the cache.

Type of change

  • Bug fix (fixes an issue)
  • New feature (adds functionality)

Related issues

Fix DUPLO-13529

internal/duplo.go Outdated Show resolved Hide resolved
Copy link
Contributor

@joek-duplo joek-duplo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the user has no access to the default tenant?
maybe, instead, just pick whatever the first tenant in the list is
after calling GetTenantsForUser

@duplodavid
Copy link
Contributor Author

what if the user has no access to the default tenant? maybe, instead, just pick whatever the first tenant in the list is after calling GetTenantsForUser

Excellent point. The ping test would fail and require re-authorization every time, which wouldn't be a great experience. I've made the change to get the list of tenants first and then take the first in the list for the ping test.

If the user has no tenants, then the ping test will fail. However, without access to a tenant, there isn't much the user can do until granted access. Those accessing new deployments are likely to be admins and should be able to see the default tenant, but if not, they likely be creating their own tenant or getting access to another shortly.

Additional note: Near future API work will allow us to simplify this solution and eliminate this edge case.

@joek-duplo joek-duplo merged commit c0aa639 into develop Dec 21, 2023
6 checks passed
@joek-duplo joek-duplo deleted the DUPLO-13529-better-duplo-token-ping-api branch December 21, 2023 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants