Skip to content

Commit

Permalink
chore(cran): Prepare for CRAN release
Browse files Browse the repository at this point in the history
* Update roxygen2

* Style DESCRIPTION

* REVERTME change URLs

* REVERTME change maintainer

* Use RStudio

* Use tidy descrition

* Use package-doc

* REVERTME creator

* Add package-doc

* REVERTME change maintainer

* Fix param name app_url -> url

* Add a simple test to keep tests happy

* Check on CI

* Use test coverage

* Use pkgdown on GHA

* Add NEWS.md

* Redocument

* Use cran-comments.md

* Update NEWS.md

* Use readme RMD

* Polish DESCRIPTION

* No rd for internals

* No rd for internals

* Update LICENSE

* 'for R Applications' may be considered redundant by CRAN

* Polish DESCRIPTION (remove pakcage name)

* Polish DESCRIPTION

* REVERTME maintainer

* Redocument

* REVERTME maintainer

* REVERTME maintainer

* Use covr

* Remove test

* Update installation

* Update installation

* Polish README

* Revert "REVERTME maintainer"

This reverts commit c4bf049.

* Revert "REVERTME maintainer"

This reverts commit 91ad24e.

* Revert "REVERTME maintainer"

This reverts commit 1f5983c.

* Revert "REVERTME change maintainer"

This reverts commit b4b8600.

* Revert

* Revert "REVERTME change URLs"

This reverts commit 0c6c026.

* Prune
  • Loading branch information
maurolepore authored Aug 27, 2024
1 parent 5428e19 commit 493f95a
Show file tree
Hide file tree
Showing 27 changed files with 434 additions and 150 deletions.
6 changes: 6 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
^pkgdown$
^.github$
^example$
^tapLock\.Rproj$
^\.Rproj\.user$
^\.github$
^cran-comments\.md$
^README\.Rmd$
^codecov\.yml$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
52 changes: 52 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
15 changes: 11 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
Expand All @@ -17,7 +24,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -36,7 +43,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ rsconnect/
example/.Renviron
docs
inst/doc
.Rproj.user
46 changes: 23 additions & 23 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
Package: tapLock
Title: Seamless SSO for R Applications
Title: Seamless Single Sign-On
Version: 0.1.0
Authors@R:
c(person(given = "ixpantia, SRL",
role = "cph",
email = "[email protected]"),
person("Andres", "Quintero", , "[email protected]", role = c("aut", "cre")))
Description: The ultimate R package for swift and seamless Single Sign-On (SSO)
integration. Designed for effortless compatibility with popular SSO providers
like Google and Microsoft, tapLock streamlines authentication, enhancing both
user experience and application security. Elevate your R-based projects with
tapLock for a simplified, unified, and secure authentication process.
Authors@R: c(
person("ixpantia, SRL", , , "hola@ixpantia.com", role = "cph"),
person("Andres", "Quintero", , "[email protected]", role = c("aut", "cre"))
)
Description: Swift and seamless Single Sign-On (SSO) integration. Designed
for effortless compatibility with popular Single Sign-On providers
like Google and Microsoft, it streamlines authentication, enhancing
both user experience and application security. Elevate your R-based
projects for a simplified, unified, and secure authentication process.
License: MIT + file LICENSE
URL: https://github.com/ixpantia/tapLock
BugReports: https://github.com/ixpantia/tapLock/issues
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Imports:
httr2,
stringr,
jose,
purrr,
promises,
curl,
future,
glue,
httr2,
jose,
lubridate,
future,
stats
promises,
purrr,
stats,
stringr
Suggests:
knitr,
rmarkdown,
shiny,
testthat (>= 3.0.0)
VignetteBuilder: knitr
VignetteBuilder:
knitr
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2023
YEAR: 2024
COPYRIGHT HOLDER: tapLock authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2023 tapLock authors
Copyright (c) 2024 tapLock authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# tapLock 0.1.0

* Initialize NEWS.md.
6 changes: 6 additions & 0 deletions R/auth.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
#'
#' @return An access_token object
#' @keywords internal
#' @noRd
access_token <- function(config, token_str) {
UseMethod("access_token")
}

#' @keywords internal
#' @noRd
access_token.google_config <- function(config, token_str) {
token_data <- decode_token(config, token_str)
structure(
Expand All @@ -25,6 +27,7 @@ access_token.google_config <- function(config, token_str) {
}

#' @keywords internal
#' @noRd
access_token.entra_id_config <- function(config, token_str) {
token_data <- decode_token(config, token_str)
structure(
Expand All @@ -39,6 +42,7 @@ access_token.entra_id_config <- function(config, token_str) {
}

#' @keywords internal
#' @noRd
access_token.auth0_config <- function(config, token_str) {
token_data <- decode_token(config, token_str)
structure(
Expand Down Expand Up @@ -106,6 +110,7 @@ is_expired <- function(token) {
#'
#' @return A string containing the Authorization header
#' @keywords internal
#' @noRd
get_bearer <- function(token) {
paste0("Bearer ", token$access_token)
}
Expand All @@ -117,6 +122,7 @@ get_bearer <- function(token) {
#'
#' @return A string containing the access token
#' @keywords internal
#' @noRd
get_access_token <- function(token) {
token$access_token
}
Expand Down
7 changes: 7 additions & 0 deletions R/auth0.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#' @keywords internal
#' @noRd
build_auth0_login_url <- function(auth_url, client_id, redirect_uri) {
url <- httr2::url_parse(auth_url)
url$query <- list(
Expand Down Expand Up @@ -44,16 +45,19 @@ new_auth0_config <- function(client_id, client_secret, auth0_domain, app_url) {
}

#' @keywords internal
#' @noRd
get_login_url.auth0_config <- function(config) {
config$login_url
}

#' @keywords internal
#' @noRd
get_logout_url.auth0_config <- function(config) {
stop("Not implemented")
}

#' @keywords internal
#' @noRd
request_token.auth0_config <- function(config, authorization_code) {
res <- httr2::request(config$token_url) |>
httr2::req_method("POST") |>
Expand All @@ -74,6 +78,7 @@ request_token.auth0_config <- function(config, authorization_code) {
}

#' @keywords internal
#' @noRd
decode_token.auth0_config <- function(config, token) {
decoded <- config$jwks |>
purrr::map(function(jwk) {
Expand All @@ -93,11 +98,13 @@ decode_token.auth0_config <- function(config, token) {
}

#' @keywords internal
#' @noRd
get_client_id.auth0_config <- function(config) {
config$client_id
}

#' @keywords internal
#' @noRd
shiny_app.auth0_config <- function(config, app) {
app_handler <- app$httpHandler
login_handler <- function(req) {
Expand Down
6 changes: 6 additions & 0 deletions R/tapLock-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if_length_0 <- function(x, y) {
#' @description If the app URL does not end with a slash, this function
#' will add one.
#'
#' @param app_url A string containing a URL
#' @param url A string containing a URL
#'
#' @return A string containing the URL with a trailing slash
#' @keywords internal
Expand Down
Loading

0 comments on commit 493f95a

Please sign in to comment.