Secure entry and storage for SharePoint creds#7
Open
brendan-newlon wants to merge 2 commits intoLukasK13:masterfrom
brendan-newlon:brendan-newlon-patch-secure-credentials
Open
Secure entry and storage for SharePoint creds#7brendan-newlon wants to merge 2 commits intoLukasK13:masterfrom brendan-newlon:brendan-newlon-patch-secure-credentials
brendan-newlon wants to merge 2 commits intoLukasK13:masterfrom
brendan-newlon:brendan-newlon-patch-secure-credentials
Conversation
Added option to enter Username and Password securely and store in system key store. Added function to delete those saved keys from system key store.
brendan-newlon
commented
Feb 19, 2020
| Username = credentials$Username # save username | ||
| Password = credentials$Password # save password | ||
| } | ||
| } |
Author
There was a problem hiding this comment.
Sorry, this closing curly brace should be removed.
LukasK13
requested changes
Feb 20, 2020
| # Last chance to enter Username | ||
| if (is.null(Username)) { # No Username is given | ||
| if ("sharepointr_username" %in% key_list("sharepointr_username")$service) { # Check system key store | ||
| Username <- key_get("sharepointr_username") |
Owner
There was a problem hiding this comment.
Suggested change
| Username <- key_get("sharepointr_username") | |
| Username <- keyring::key_get("sharepointr_username") |
| Username <- key_get("sharepointr_username") | ||
| } else { # Username not in key store | ||
| Username <- rstudioapi::askForSecret("Enter SharePoint Username") | ||
| key_set_with_value("sharepointr_username", password = Username) |
Owner
There was a problem hiding this comment.
Suggested change
| key_set_with_value("sharepointr_username", password = Username) | |
| keyring::key_set_with_value("sharepointr_username", password = Username) |
| # Last chance to enter Password | ||
| if (is.null(Password)) { # No Password is given | ||
| if ("sharepointr_password" %in% key_list("sharepointr_password")$service) { # Check system key store | ||
| Password <- key_get("sharepointr_password") |
Owner
There was a problem hiding this comment.
Suggested change
| Password <- key_get("sharepointr_password") | |
| Password <- keyring::key_get("sharepointr_password") |
| Password <- key_get("sharepointr_password") | ||
| } else { # Password not in key store | ||
| Password <- rstudioapi::askForSecret("Enter SharePoint Password") | ||
| key_set_with_value("sharepointr_password", password = Password) |
Owner
There was a problem hiding this comment.
Suggested change
| key_set_with_value("sharepointr_password", password = Password) | |
| keyring::key_set_with_value("sharepointr_password", password = Password) |
| if ("sharepointr_username" %in% key_list("sharepointr_username")$service) { # Check system key store | ||
| Username <- key_get("sharepointr_username") | ||
| } else { # Username not in key store | ||
| Username <- rstudioapi::askForSecret("Enter SharePoint Username") |
Owner
There was a problem hiding this comment.
What happens during non interactive session?
| if ("sharepointr_password" %in% key_list("sharepointr_password")$service) { # Check system key store | ||
| Password <- key_get("sharepointr_password") | ||
| } else { # Password not in key store | ||
| Password <- rstudioapi::askForSecret("Enter SharePoint Password") |
Owner
There was a problem hiding this comment.
What happens during non interactive session?
| #' sp_clearKeys() | ||
| sp_clearKeys <- function() { | ||
| # Delete the Username if stored in system key store. | ||
| if ("sharepointr_username" %in% key_list("sharepointr_username")$service) {key_delete("sharepointr_username")} |
Owner
There was a problem hiding this comment.
Suggested change
| if ("sharepointr_username" %in% key_list("sharepointr_username")$service) {key_delete("sharepointr_username")} | |
| if ("sharepointr_username" %in% keyring::key_list("sharepointr_username")$service) {keyring::key_delete("sharepointr_username")} |
| # Delete the Username if stored in system key store. | ||
| if ("sharepointr_username" %in% key_list("sharepointr_username")$service) {key_delete("sharepointr_username")} | ||
| # Delete the Password if stored in system key store. | ||
| if ("sharepointr_password" %in% key_list("sharepointr_password")$service) {key_delete("sharepointr_password")} |
Owner
There was a problem hiding this comment.
Suggested change
| if ("sharepointr_password" %in% key_list("sharepointr_password")$service) {key_delete("sharepointr_password")} | |
| if ("sharepointr_password" %in% keyring::key_list("sharepointr_password")$service) {keyring::key_delete("sharepointr_password")} |
Owner
|
Hey @brendan-newlon
|
Fix dependencies
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.
I added an option to enter Username and Password securely and store both in the system key store when a credential isn't provided.
I also added a function sp_clearKeys() to delete those saved keys from the system key store to allow connecting with different credentials from the same system account.