A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://datastorm-open.github.io/shinymanager/reference/check_credentials.html below:

Check credentials — check_credentials • shinymanager

Check credentials

check_credentials(db, passphrase = NULL)
Arguments
db

A data.frame with credentials data, a path to SQLite database created with create_db or a .yaml configuration path of SQL Database created with create_sql_db.

passphrase

Passphrase to decrypt the SQLite database.

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 :

Details

The credentials data.frame can have the following columns:

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")
#> $result
#> [1] TRUE
#> 
#> $expired
#> [1] FALSE
#> 
#> $authorized
#> [1] TRUE
#> 
#> $user_info
#>    user
#> 1 fanny
#> 
check_credentials(credentials)("fanny", "azert")
#> $result
#> [1] FALSE
#> 
#> $expired
#> [1] FALSE
#> 
#> $authorized
#> [1] TRUE
#> 
#> $user_info
#>    user
#> 1 fanny
#> 
check_credentials(credentials)("fannyyy", "azerty")
#> $result
#> [1] FALSE
#> 
#> $expired
#> [1] FALSE
#> 
#> $authorized
#> [1] FALSE
#> 
#> $user_info
#> NULL
#> 

# 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")
#> $result
#> [1] TRUE
#> 
#> $expired
#> [1] FALSE
#> 
#> $authorized
#> [1] TRUE
#> 
#> $user_info
#>    user
#> 1 fanny
#> 
check_credentials(credentials)("fanny", "azert")
#> $result
#> [1] FALSE
#> 
#> $expired
#> [1] FALSE
#> 
#> $authorized
#> [1] TRUE
#> 
#> $user_info
#>    user
#> 1 fanny
#> 
check_credentials(credentials)("fannyyy", "azerty")
#> $result
#> [1] FALSE
#> 
#> $expired
#> [1] FALSE
#> 
#> $authorized
#> [1] FALSE
#> 
#> $user_info
#> NULL
#> 

if (FALSE) {

## With a SQLite database:
check_credentials("credentials.sqlite", passphrase = "supersecret")


## With a SQL database:
check_credentials("config_db.yml")

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4