-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
oauthtoken: Implement Fallback backend (#37)
This change adds two new token storage backends: * a file-based backend for use in CI systems, as proposed by #34 * a fallback backend, which consults multiple backends in order when loading a token The backend to use when storing tokens is controlled by the top-level `--store` flag, which defaults to `keyring` (a secure option); usage in CI will need to set `--store=file` if `keyring` is not expected to work (e.g. inside a Docker container with no GUI libraries installed). Both backends are consulted on `Load()` and `Delete()` operations, though this shouldn't be insecure, as it doesn't leak token info into the filesystem unless explicitly requested via the flag. Tests are added for both backends; the fake backend implementation is also fixed to obey the `LoadStorer` contract around returning `fs.ErrNotExist`, which means also fixing `engflow_auth logout` semantics when no token is stored for the current cluster. Tested: some manual testing still TODO: - [x] test that delete for cluster with no token returns error - [x] test that default stores in keyring, token still fetchable - [x] test that delete succeeds once and fails on subsequent attempts (token not found) - [x] test storing into file, token still fetchable - [x] test that delete succeeds once and fails on subsequent attempts (token not found) Bug: linear/CUS-384
- Loading branch information
1 parent
e3972d1
commit 1363f11
Showing
10 changed files
with
615 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.