Secure a Shiny application and manage authentication
secure_app(
ui,
...,
head_auth = NULL,
theme = NULL,
language = "en",
fab_position = "bottom-right"
)secure_server(
check_credentials,
timeout = 15,
inputs_list = NULL,
keep_token = FALSE,
validate_pwd = NULL,
update_credentials = NULL,
session = shiny::getDefaultReactiveDomain()
)
create_server(check_credentials, update_credentials, server_fn)
A reactiveValues containing informations about the user connected.
UI of the application.
Arguments passed to auth_ui.
Tag or list of tags to use in the <head>
of the authentication page (for custom CSS for example).
Alternative Bootstrap stylesheet, default is to use readable,
you can use themes provided by shinythemes.
It will affect the authentication panel and the admin page.
Language to use for labels, supported values are : "en", "es".
Position for the FAB button, see fab_button for options.
Function passed to auth_server.
Timeout session (minutes) before logout if sleeping. Defaut to 15. 0 to disable.
list. If database credentials, you can configure inputs for editing users information. See Details.
Logical, keep the token used to authenticate in the URL, it allow to refresh the
application in the browser, but careful the token can be shared between users ! Default to FALSE.
A function to validate the password enter by the user.
Default is to check for the password to have at least one number, one lowercase,
one uppercase and be of length 6 at least.
Function passed to chpass_server.
Shiny session.
Function that returns the authenticated server.
If database credentials, you can configure inputs with inputs_list for editing users information
from the admin console. start, expire, admin and password are not configurable.
The others columns are rendering by defaut using a textInput. You can modify this using inputs_list.
inputs_list must be a named list. Each name must be a column name, and then we must have the function
shiny to call fun and the arguments args like this :
list(group = list(
fun = "selectInput",
args = list(
choices = c("all", "restricted"),
multiple = TRUE,
selected = c("all", "restricted")
)
)
)
You can specify if you want to allow downloading users file, sqlite database and logs from within
the admin panel by invoking options("shinydbauth.download"). It defaults
to c("db", "logs", "users"), that allows downloading all. You can specify
options("shinydbauth.download" = "db" if you want allow admin to download only
sqlite database, options("shinydbauth.download" = "logs") to allow logs download
or options("shinydbauth.download" = "") to disable all.
Using options("shinydbauth.pwd_validity"), you can set password validity period. It defaults
to Inf. You can specify for example
options("shinydbauth.pwd_validity" = 90) if you want to force user changing password each 90 days.
Using options("shinydbauth.pwd_failure_limit"), you can set password failure limit. It defaults
to Inf. You can specify for example
options("shinydbauth.pwd_failure_limit" = 5) if you want to lock user account after 5 wrong password.
create_server calls secure_server and, if authentication is ok, passes user_info to server_fn