In R shinymanager: log failed logins

61 Views Asked by At

In R shinymanager, I know you can output the login data via this object

res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )

but it only shows successful logins. I would like to log failed logins. Is there a possibility?

Here's a complete working example (taken from the shinymanager page)

library(shiny)
library(shinymanager)


# define some credentials
credentials <- data.frame(
  user = c("shiny", "shinymanager"), # mandatory
  password = c("azerty", "12345"), # mandatory
  start = c("2019-04-15"), # optinal (all others)
  expire = c(NA, "2024-12-31"),
  admin = c(FALSE, TRUE),
  stringsAsFactors = FALSE
)

ui <- fluidPage(
  tags$h2("My secure application"),
  verbatimTextOutput("auth_output")
)

# Wrap your UI with secure_app
ui <- secure_app(ui)

server <- function(input, output, session) {
  # check_credentials returns a function to authenticate users
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )

  output$auth_output <- renderPrint({
    reactiveValuesToList(res_auth)
  })
}

shinyApp(ui, server)
0

There are 0 best solutions below