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

Add Logout Method #214

Merged
merged 9 commits into from
Nov 7, 2023
Merged

Add Logout Method #214

merged 9 commits into from
Nov 7, 2023

Conversation

tobias-hashicorp
Copy link
Contributor

@tobias-hashicorp tobias-hashicorp commented Nov 6, 2023

🛠️ Description

This implements a hcpConfig.Logout() method. Logout could previously be implemented by invalidating the cache. This now isn't possible anymore as the cache is not exported.

This change further removes the recently introduced forceLogin configuration value, as force login can easily be implemented by invoking hcpConfig.Logout() followed by hcpConfig.Token() without the need for a special configuration setting.

👍 Definition of Done

  • Tests added?
  • Docs updated?

The cache file path will also be needed to clear the login cache entry to enable logout.
Without this function it was not possible anymore to implement a logout functionality.
The method can be used to clear the cached login token and thus to logout a CLI session.
This should make it easier to find the tests that belong to a specific
type.
Calling ClearLoginCache() and c.Token() subsequently will have the same
effect and it does not require a specific HCP configuration just to
perform a login.
To provide guidance for users of the SDK on how they should implement
login / logout functionality.
This should make it easier for a human to read the file if necessary.
@tobias-hashicorp tobias-hashicorp changed the title Logout Ad Logout Method Nov 6, 2023
@tobias-hashicorp tobias-hashicorp changed the title Ad Logout Method Add Logout Method Nov 6, 2023
It is not necessary to persist `"login": null` or `"service-principals": {}`.
@tobias-hashicorp tobias-hashicorp merged commit bbf60d2 into main Nov 7, 2023
@tobias-hashicorp tobias-hashicorp deleted the tobias/logout branch November 7, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants