Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Imports:
Suggests:
knitr,
rmarkdown,
testthat
testthat,
withr
VignetteBuilder:
knitr
Remotes:
Expand All @@ -69,4 +70,4 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Config/roxygen2/version: 8.1.1
200 changes: 116 additions & 84 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,103 +44,135 @@ export(write_log)
import(htmltools)
import(pkgdown)
importFrom(assertthat,assert_that)
importFrom(cli,ansi_strip)
importFrom(cli,cat_line)
importFrom(cli,cli_abort)
importFrom(cli,cli_alert_info)
importFrom(cli,cli_alert_success)
importFrom(cli,cli_alert_warning)
importFrom(cli,cli_bullets)
importFrom(cli,cli_progress_bar)
importFrom(cli,cli_progress_done)
importFrom(cli,cli_progress_update)
importFrom(cli,cli_warn)
importFrom(cli,tree)
importFrom(cli,
ansi_strip,
cat_line,
cli_abort,
cli_alert_info,
cli_alert_success,
cli_alert_warning,
cli_bullets,
cli_progress_bar,
cli_progress_done,
cli_progress_update,
cli_warn,
tree
)
importFrom(config,get)
importFrom(covr,package_coverage)
importFrom(covr,report)
importFrom(covr,
package_coverage,
report
)
importFrom(covrpage,covrpage)
importFrom(digest,digest)
importFrom(dplyr,mutate)
importFrom(dplyr,pull)
importFrom(fs,dir_create)
importFrom(fs,dir_exists)
importFrom(fs,dir_info)
importFrom(fs,dir_ls)
importFrom(fs,file_create)
importFrom(fs,file_exists)
importFrom(fs,file_move)
importFrom(fs,path)
importFrom(fs,path_dir)
importFrom(fs,path_ext)
importFrom(fs,path_package)
importFrom(gargle,gargle_oauth_client_from_json)
importFrom(gargle,init_AuthState)
importFrom(dplyr,
mutate,
pull
)
importFrom(fs,
dir_create,
dir_exists,
dir_info,
dir_ls,
file_create,
file_exists,
file_move,
path,
path_dir,
path_ext,
path_package
)
importFrom(gargle,
gargle_oauth_client_from_json,
init_AuthState
)
importFrom(gitdown,git_down)
importFrom(glue,glue)
importFrom(htmltools,HTML)
importFrom(htmltools,htmlDependency)
importFrom(htmltools,tagList)
importFrom(htmltools,tags)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr2,req_auth_bearer_token)
importFrom(httr2,req_headers)
importFrom(httr2,req_method)
importFrom(httr2,req_perform)
importFrom(httr2,req_url_path_append)
importFrom(httr2,request)
importFrom(httr2,resp_body_json)
importFrom(htmltools,
HTML,
htmlDependency,
tagList,
tags
)
importFrom(httr,
GET,
content
)
importFrom(httr2,
req_auth_bearer_token,
req_headers,
req_method,
req_perform,
req_url_path_append,
request,
resp_body_json
)
importFrom(jsonlite,fromJSON)
importFrom(lubridate,weeks)
importFrom(markdown,markdownToHTML)
importFrom(metathis,meta)
importFrom(metathis,meta_social)
importFrom(metathis,
meta,
meta_social
)
importFrom(parallel,detectCores)
importFrom(pdftools,pdf_data)
importFrom(pdftools,pdf_text)
importFrom(pdftools,
pdf_data,
pdf_text
)
importFrom(pkgdown,build_site)
importFrom(pkgload,pkg_name)
importFrom(purrr,map)
importFrom(purrr,map_chr)
importFrom(purrr,pluck)
importFrom(purrr,pmap_chr)
importFrom(purrr,pwalk)
importFrom(rlang,abort)
importFrom(rlang,cnd_entrace)
importFrom(rlang,current_env)
importFrom(rlang,entrace)
importFrom(rlang,error_cnd)
importFrom(rlang,trace_back)
importFrom(stringr,boundary)
importFrom(stringr,str_detect)
importFrom(stringr,str_extract)
importFrom(stringr,str_match)
importFrom(stringr,str_replace)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_to_lower)
importFrom(stringr,str_trim)
importFrom(purrr,
map,
map_chr,
pluck,
pmap_chr,
pwalk
)
importFrom(rlang,
abort,
cnd_entrace,
current_env,
entrace,
error_cnd,
trace_back
)
importFrom(stringr,
boundary,
str_detect,
str_extract,
str_match,
str_replace,
str_replace_all,
str_to_lower,
str_trim
)
importFrom(testdown,test_down)
importFrom(tibble,tibble)
importFrom(tibblify,tib_chr)
importFrom(tibblify,tib_dbl)
importFrom(tibblify,tib_df)
importFrom(tibblify,tib_lgl)
importFrom(tibblify,tib_row)
importFrom(tibblify,tib_unspecified)
importFrom(tibblify,tibblify)
importFrom(tibblify,tspec_object)
importFrom(tibblify,
tib_chr,
tib_dbl,
tib_df,
tib_lgl,
tib_row,
tib_unspecified,
tibblify,
tspec_object
)
importFrom(tidyr,unnest)
importFrom(togglr,get_time_entries)
importFrom(togglr,get_toggl_api_token)
importFrom(togglr,set_toggl_api_token)
importFrom(togglr,toggl_start)
importFrom(togglr,toggl_stop)
importFrom(togglr,
get_time_entries,
get_toggl_api_token,
set_toggl_api_token,
toggl_start,
toggl_stop
)
importFrom(usethis,use_news_md)
importFrom(utils,assignInMyNamespace)
importFrom(xml2,read_html)
importFrom(xml2,xml_children)
importFrom(xml2,xml_find_all)
importFrom(xml2,xml_find_first)
importFrom(xml2,xml_name)
importFrom(xml2,xml_text)
importFrom(xml2,
read_html,
xml_children,
xml_find_all,
xml_find_first,
xml_name,
xml_text
)
25 changes: 23 additions & 2 deletions R/auth0_jwt.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,30 @@ get_auth0_jwt <- function(
rlang::abort("No Auth0 configuration found")
}

httr2::curl_translate(
"curl --request POST --url https://jimbrig.us.auth0.com/oauth/token --header 'content-type: application/json' --data '{\"client_id\":\"tCLHUNuGdBXlaeZ94OrHfjVOUVuFPRte\",\"client_secret\":\"te2n7aYvXPYflth3OFMi8QK5c7obtjoJPNxfBfs1LKQIx2j9YfobR2rPKWsbEz-3\",\"audience\":\"https://auth-api.noclocks.dev\",\"grant_type\":\"client_credentials\"}'"
required_fields <- c(
"jwt_url", "client_id", "client_secret", "audience", "grant_type"
)
if (!is.list(auth0_config)) {
rlang::abort("Auth0 configuration must be a named list")
}
invalid_fields <- required_fields[!vapply(
required_fields,
function(field) {
value <- auth0_config[[field]]
is.character(value) && length(value) == 1L &&
!is.na(value) && nzchar(trimws(value))
},
logical(1)
)]
if (length(invalid_fields) > 0L) {
rlang::abort(paste0(
"Auth0 configuration requires non-empty string values for: ",
paste(invalid_fields, collapse = ", ")
))
}
if (!grepl("^https://[^/?#[:space:]]+", auth0_config$jwt_url)) {
rlang::abort("Auth0 jwt_url must use HTTPS")
}

base_url <- auth0_config$jwt_url
client_id <- auth0_config$client_id
Expand Down
1 change: 1 addition & 0 deletions inst/config/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
!.gitignore
!README.md
!auth0.yml
!auth0-jwt.template.yml
!config.template.yml
!credentials.template.json
!keeper.config.template.json
Expand Down
22 changes: 22 additions & 0 deletions inst/config/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Configurations

## Auth0 JWT requests

`get_auth0_jwt()` reads the `auth0` section of `config::get()`, or accepts an
explicit configuration list with `jwt_url`, `client_id`, `client_secret`,
`audience`, and `grant_type`. Existing lists with those fields remain supported.
The token endpoint must use HTTPS, and every field must be a non-empty string.

Copy `auth0-jwt.template.yml` to the ignored project-root `config.yml`, or merge
its `auth0` section into an existing configuration. Populate `AUTH0_JWT_URL`,
`AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`, and `AUTH0_AUDIENCE` through your secret
manager or deployment environment. The template uses the `client_credentials`
grant. Do not commit populated configuration, environment files, or tokens.

The separate `auth0.yml` template uses a different configuration structure and
does not supply the fields required by `get_auth0_jwt()`.

Source cleanup does not invalidate previously exposed secrets. Before rotating
an application secret in Auth0, inventory its consumers and arrange secure
configuration updates. After rotation, verify token issuance with the replacement
and rejection of the old secret after propagation. Previously issued access
tokens require a separate containment assessment until they expire.

## Integrations

- Slack:
Expand Down
9 changes: 9 additions & 0 deletions inst/config/auth0-jwt.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copy to the ignored project-root config.yml, or merge into an existing config.
# Populate environment variables through a secret manager or deployment settings.
default:
auth0:
jwt_url: !expr Sys.getenv("AUTH0_JWT_URL")
client_id: !expr Sys.getenv("AUTH0_CLIENT_ID")
client_secret: !expr Sys.getenv("AUTH0_CLIENT_SECRET")
audience: !expr Sys.getenv("AUTH0_AUDIENCE")
grant_type: client_credentials
2 changes: 1 addition & 1 deletion man/build_pkgdown_with_reports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions man/dot-noclocks_colors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/noclocksr-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/process_pdfs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/use_noclocks_meta.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading