Description Usage Arguments Details Value Examples
View source: R/check_credentials.R
Check credentials
1 | check_credentials(db, passphrase = NULL)
|
db |
A |
passphrase |
Passphrase to decrypt the SQLite database. |
The credentials data.frame
can have the following columns:
user (mandatory) : the user's name.
password (mandatory) : the user's password.
admin (optional) : logical, is user have admin right ? If so, user can access the admin mode (only available using a SQLite database)
start (optional) : the date from which the user will have access to the application
expire (optional) : the date from which the user will no longer have access to the application
applications (optional) : the name of the applications to which the user is authorized,
separated by a semicolon. The name of the application corresponds to the name of the directory,
or can be declared using : options("shinymanager.application" = "my-app")
additional columns : add others columns to retrieve the values server-side after authentication
Return a function
with two arguments: user
and password
to be used in module-authentication
. The authentication function returns
a list
with 3 slots :
result : logical, result of authentication.
expired : logical, is user has expired ? Always FALSE
if db
doesn't have a expire
column.
user_info : the line in db
corresponding to the user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # data.frame with credentials info
credentials <- data.frame(
user = c("fanny", "victor"),
password = c("azerty", "12345"),
stringsAsFactors = FALSE
)
# check a user
check_credentials(credentials)("fanny", "azerty")
check_credentials(credentials)("fanny", "azert")
check_credentials(credentials)("fannyyy", "azerty")
# data.frame with credentials info
# using hashed password with scrypt
credentials <- data.frame(
user = c("fanny", "victor"),
password = c(scrypt::hashPassword("azerty"), scrypt::hashPassword("12345")),
is_hashed_password = TRUE,
stringsAsFactors = FALSE
)
# check a user
check_credentials(credentials)("fanny", "azerty")
check_credentials(credentials)("fanny", "azert")
check_credentials(credentials)("fannyyy", "azerty")
## Not run:
## With a SQLite database:
check_credentials("credentials.sqlite", passphrase = "supersecret")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.