-
Notifications
You must be signed in to change notification settings - Fork 10
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
Secure entry and storage for SharePoint creds #7
base: master
Are you sure you want to change the base?
Secure entry and storage for SharePoint creds #7
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.
} else { # credential file is given | ||
credentials = yaml::read_yaml(credentialFile) # read credential file | ||
Username = credentials$Username # save username | ||
Password = credentials$Password # save password | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this closing curly brace should be removed.
# 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")} |
Hey @brendan-newlon
|
Fix dependencies
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.