Skip to content

Commit 8c6e825

Browse files
committed
Fixes for auth
1 parent f7238f9 commit 8c6e825

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

R/Plumber2.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ Plumber2 <- R6Class(
888888
#'
889889
add_auth_guard = function(guard, name = NULL) {
890890
fp <- self$plugins$fireproof
891+
# Needed to initialize router in app
892+
router <- self$request_router
891893
if (is.null(fp)) {
892894
fp <- fireproof::Fireproof$new()
893895
self$attach(fp)

R/parse_plumber_file.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ parse_asset_block <- function(call, tags, values, env, file_dir) {
324324
}
325325

326326
parse_auth_guard_block <- function(call, tags, values, env) {
327-
if (!is.function(call) || fireproof::is_guard(call)) {
328-
stop_input_type(call, "an {.cls Guard} subclass object or a function")
327+
if (!is.function(call) && !fireproof::is_guard(call)) {
328+
stop_input_type(call, cli::format_inline("an {.cls Guard} subclass object or a function"))
329329
}
330330
name <- trimws(values[[which(tags == "authGuard")[1]]])
331331
structure(
@@ -819,7 +819,7 @@ parse_auth_tags <- function(tags, values) {
819819
if ("auth" %in% tags) {
820820
flow <- trimws(values[[which(tags == "auth")[1]]])
821821
flow <- parse_quo(flow, empty_env())
822-
if ("authScope" %||% tags) {
822+
if ("authScope" %in% tags) {
823823
scope <- unlist(values[tags == "authScope"])
824824
scope <- unlist(trimws(unlist(strsplit(scope, ","))))
825825
} else {

0 commit comments

Comments
 (0)