| secure-app | R Documentation |
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)
ui |
UI of the application. |
... |
Arguments passed to |
head_auth |
Tag or list of tags to use in the |
theme |
Alternative Bootstrap stylesheet, default is to use |
language |
Language to use for labels, supported values are : "en", "es". |
fab_position |
Position for the FAB button, see |
check_credentials |
Function passed to |
timeout |
Timeout session (minutes) before logout if sleeping. Defaut to 15. 0 to disable. |
inputs_list |
|
keep_token |
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 |
validate_pwd |
A |
update_credentials |
Function passed to |
session |
Shiny session. |
server_fn |
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
A reactiveValues containing informations about the user connected.
A special input value will be accessible server-side with input$shinydbauth_where
to know in which step user is : authentication, application, admin or password.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.