datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
386 stars 79 forks source link

Extract username #27

Closed muntean-alex closed 4 years ago

muntean-alex commented 4 years ago

Hi,

Would it be possible to extract the username that has logged in? I want to use this to filter the df according to user rights.

I wanted to make an encrypted file with bcrypt for extra security. Have you ever considered this?

aephidayatuloh commented 4 years ago

Hi, Just share my experince about this. For example, assume you use secure_server() inside the server function.

auth <- secure_server(
  check_credentials = check_credentials(credentials)
)

You can get the username with auth$user or auth$user_info$user. You also can get other information that correspond to your credentials table with auth$user_info$<column>. CMIIW

BrianCollinss commented 3 years ago

Hey guys. I wonder if you have a way to send the username to the UI side. I see that we can have reactiveValuesToList(res_auth) on the server side. But I can only send a text to the UI side, not the username. I am trying to have different UI layour for dofferent users.

BrianCollinss commented 2 years ago

@aephidayatuloh Hi, I use the following on the server side:

auth <- callModule(module=auth_server,id="auth",check_credentials=check_credentials(credentials))

and the following on the UI side:

  auth_ui(id = "auth", background="url('/background-image.jpg') center/cover no-repeat;", lan = use_language("en"),
                          tags_top=tags$div(tags$h2(tags$b("WELCOME TO INCENTIV8", style = "text-align:center"))),
                          tags_bottom=tags$div(tags$p("For any question or to request a username/password, please contact ",
                                                      tags$a(href="mailto:brian.collins@jcu.edu.au?Subject=From%20INCENTIV8%20App",target="_top","administrator"))),

But the auth$user_info is always NULL.