Skip to content

Commit

Permalink
add addin support
Browse files Browse the repository at this point in the history
  • Loading branch information
jgbradley1 committed Mar 16, 2020
1 parent 67cbff5 commit 37633aa
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
26 changes: 26 additions & 0 deletions R/pki_enable_download_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@ pki_enable_download_file <- function(mypki_file = NULL,
}


addin_pki_enable_download_file <- function() {
result <- rstudioapi::showQuestion("rpki", "Please select your PKI certificate (*.p12)")
if (result) {
p12_file <- rstudioapi::selectFile(
caption = "PKI File",
label = "Select",
path = rstudioapi::getActiveProject(),
filter = "*.p12",
existing = TRUE
)
print(p12_file)
}
continue <- rstudioapi::showQuestion("rpki", "Please select your Certificate Authority (CA) bundle (*.crt)")
if (continue) {
ca_file <- rstudioapi::selectFile(
caption = "CA Bundle",
label = "Select",
path = rstudioapi::getActiveProject(),
filter = "*.crt",
existing = TRUE
)
print(ca_file)
}
}


#' @import openssl
#' @importFrom getPass getPass
set_download_file_config <- function(ca_file = NULL, pki_file = NULL, pass = NULL) {
Expand Down
25 changes: 25 additions & 0 deletions R/pki_enable_httr.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,31 @@ pki_enable_httr <- function(mypki_file = NULL,
}


addin_pki_enable_httr <- function() {
continue <- rstudioapi::showQuestion("rpki", "Please select your PKI certificate (*.p12)")
if (continue) {
p12_file <- rstudioapi::selectFile(
caption = "PKI File",
label = "Select",
path = rstudioapi::getActiveProject(),
filter = "*.p12",
existing = TRUE
)
print(p12_file)
}
continue <- rstudioapi::showQuestion("rpki", "Please select your Certificate Authority (CA) bundle (*.crt)")
if (continue) {
ca_file <- rstudioapi::selectFile(
caption = "CA Bundle",
label = "Select",
path = rstudioapi::getActiveProject(),
filter = "*.crt",
existing = TRUE
)
print(ca_file)
}
}

#' @import openssl
#' @importFrom getPass getPass
set_httr_config <- function(ca_file = NULL, pki_file = NULL, pass = NULL) {
Expand Down
9 changes: 9 additions & 0 deletions inst/rstudio/addins.dcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Name: PKI-enable install.packages()
Description: setup install.packages() with pki authentication
Binding: addin_pki_enable_download_file
Interactive: true

Name: PKI-enable httr
Description: setup httr config options for pki authentication
Binding: addin_pki_enable_httr
Interactive: true

0 comments on commit 37633aa

Please sign in to comment.