Feature/support oauth2 secret in keyring#17
Open
notthatjesus wants to merge 7 commits into
Open
Conversation
Adds clientSecretKey(), GetClientSecret(), SetClientSecret(), and DeleteClientSecret() for OAuth2 client secrets, stored under account/<name>/oauth2_client_secret — separate from the password slot.
Adds resolveKeyringClientSecret() mirroring resolveKeyringPassword(). Setting oauth2_client_secret = "keyring" in config.toml now causes Load() to fetch the secret from the OS keyring instead of using the sentinel as a literal value.
Adds TestResolveKeyringClientSecret (four sub-tests: resolved, missing, passthrough, empty account) and TestLoad_KeyringResolvesClientSecret (end-to-end Load() coverage) mirroring the existing password tests.
Extends the promptType enum with promptOAuth2Secret and adds matching title/hint text in View() so the same masked-input dialog can be used for OAuth2 client secrets.
Adds statePasswordPrompt viewState, passwordPrompt field, and handlers for passwordSubmittedMsg and passwordCancelledMsg. On submit, dispatches to keyring.SetClientSecret or keyring.SetPassword depending on prompt type.
Wires the new command to the password prompt in promptOAuth2Secret mode, allowing users to store the OAuth2 client secret in the OS keyring from within the TUI.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is it about
This PR implements the same feature to store the password in the OS keyring to support as well the oauth2_secret.
How does it work
It follows the same implementation as the password storage with the difference that it uses the key:
account/account_name/oauth2_client_secretto store it.Additional features
It reuses the code that was created for the
set-passwordcommand and registers aset-oauth2-secret. While theset-passwordcommand is not wired to the keyring SetPassword() function, the new command calls SetClientSecret(). I will send an additional PR to do the same for SetPassword.How to test
Store your oauth2_client_secret using
secret-toolReplace the actual oauth2_client_secret field in
config.tomltokeyringStart neomd normally