Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
^README\.Rmd$
^codecov\.yml$
^Makefile$
^src/\.cargo$
^src/rust/vendor$
^src/Makevars$
^src/Makevars\.win$
^Taskfile.yml$
^src/rust/target$
4 changes: 3 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [main, master]

name: R-CMD-check.yaml
name: R CMD Check

permissions: read-all

Expand Down Expand Up @@ -50,3 +50,5 @@ jobs:
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
env:
NOT_CRAN: false
56 changes: 0 additions & 56 deletions .github/workflows/tests.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ example/.Renviron
docs
inst/doc
.Rproj.user
src/rust/vendor
src/Makevars
src/Makevars.win
14 changes: 7 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ Description: Swift and seamless Single Sign-On (SSO) integration. Designed
License: MIT + file LICENSE
URL: https://github.com/ixpantia/tapLock
BugReports: https://github.com/ixpantia/tapLock/issues
Depends: R (>= 4.2.0)
Imports:
curl,
glue,
httr2,
jose,
lubridate,
promises,
purrr,
stats,
stringr,
shiny,
tower (>= 0.2.0)
later,
methods,
tower (>= 0.2.0),
rlang
Suggests:
knitr,
rmarkdown,
Expand All @@ -35,3 +33,5 @@ Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Config/rextendr/version: 0.3.1.9001
SystemRequirements: Cargo (Rust's package manager), rustc, OpenSSL >= 1.0.2
13 changes: 0 additions & 13 deletions Makefile

This file was deleted.

12 changes: 8 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Generated by roxygen2: do not edit by hand

S3method(internal_add_auth_layers,entra_id_config)
S3method(internal_add_auth_layers,google_config)
S3method("$",AsyncFuture)
S3method("$",FutureResult)
S3method("$",OAuth2Runtime)
S3method("[[",AsyncFuture)
S3method("[[",FutureResult)
S3method("[[",OAuth2Runtime)
S3method(print,access_token)
export(add_auth_layers)
export(expires_at)
export(expires_in)
export(get_token_field)
export(hello_world)
export(is_expired)
export(is_valid)
export(new_auth0_config)
export(new_entra_id_config)
export(new_google_config)
export(new_openid_config)
export(token)
useDynLib(tapLock, .registration = TRUE)
66 changes: 6 additions & 60 deletions R/auth.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,10 @@
#' @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(
list(
access_token = token_str,
exp = lubridate::as_datetime(token_data$exp),
iat = lubridate::as_datetime(token_data$iat),
token_data = token_data
),
class = c("google_token", "access_token")
)
}

#' @keywords internal
#' @noRd
access_token.entra_id_config <- function(config, token_str) {
token_data <- decode_token(config, token_str)
structure(
list(
access_token = token_str,
exp = lubridate::as_datetime(token_data$exp),
iat = lubridate::as_datetime(token_data$iat),
token_data = token_data
),
class = c("entra_id_token", "access_token")
)
}

#' @keywords internal
#' @noRd
access_token.auth0_config <- function(config, token_str) {
token_data <- decode_token(config, token_str)
structure(
list(
access_token = token_str,
exp = lubridate::as_datetime(token_data$exp),
iat = lubridate::as_datetime(token_data$iat),
token_data = token_data
),
class = c("auth0_token", "access_token")
)
if (length(token_str) == 0) {
return(error("No access_token provided"))
}
config$decode_token(token_str)
}

#' @title Print an access token
Expand Down Expand Up @@ -112,8 +70,8 @@ is_expired <- function(token) {
#' @return A string containing the Authorization header
#' @keywords internal
#' @noRd
get_bearer <- function(token) {
paste0("Bearer ", token$access_token)
add_bearer <- function(token) {
paste0("Bearer ", token)
}

#' @title Get the access token string
Expand Down Expand Up @@ -149,15 +107,3 @@ expires_in <- function(token) {
expires_at <- function(token) {
token$exp
}

#' @title Get the issued at time of an access token
#' @description Gets the issued at time of an access token
#'
#' @param token An access_token object
#' @param field The field to get from the token
#'
#' @return A POSIXct object containing the date and time the token was issued
#' @export
get_token_field <- function(token, field) {
token$token_data[[field]]
}
Loading
Loading