check_credentials {shinymanager}R Documentation

Check credentials

Description

Check credentials

Usage

check_credentials(db, passphrase = NULL)

Arguments

db

A data.frame with credentials data or path to SQLite database created with create_db.

passphrase

Passphrase to decrypt the SQLite database.

Details

The credentials data.frame can have the following columns:

Value

Return a function with two arguments: user and password to be used in module-authentication. The authentication function returns a list with 4 slots :

Examples

# 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)


[Package shinymanager version 1.0.410 Index]