Runable example for "Authentication and database"

Hi

do you have templates for managing multiple users in a shiny application, like

https://shiny.rstudio.com/gallery/personalized-ui.html
https://shiny.rstudio.com/gallery/authentication-and-database.html

(Unfortunately the source is incomplete and will probably be different for shinyproxy)

I’m excited to hear some tips

Christof

Hi @ckluss,

If you use the openanalytics/shinyproxy-demo image (e.g. when working through the getting started guide at http://www.shinyproxy.io/getting-started/), it allows to see the group based authorization at work:

  • when you log in as user ‘tesla’ (password ‘password’) who is part of the scientists user group, you will see two applications;
  • if you log in as user ‘gauss’ (password ‘password’) who is part of the mathematicians user group, you will see only one application

This authorization logic is configured in the apps block of the default application.yml file:

(full source at https://github.com/openanalytics/shinyproxy/blob/master/src/main/resources/application-demo.yml):

  apps:
  - name: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    docker-cmd: ["R", "-e shinyproxy::run_01_hello()"]
    docker-image: openanalytics/shinyproxy-demo
    groups: scientists, mathematicians
  - name: 06_tabsets
    docker-cmd: ["R", "-e shinyproxy::run_06_tabsets()"]
    docker-image: openanalytics/shinyproxy-demo
    groups: scientists
  • for the 01_hello application you see groups: scientists, mathematicians
  • for the 06_tabsets application you only see groups: scientists

The definition of which users belong to which groups is done in the LDAP directory.

Hope this helps,
Tobias

Hi @tverbeke

thank you very much!

Is it possible to query the user name within the application?

session$user seems not to work

Best wishes
Christof

Hello @ckluss,

The user name of the authenticated user is made available to the Shiny application via the environment variable SHINYPROXY_USERNAME (from http://www.shinyproxy.io/configuration/#ldap),
so from Shiny you can query it using something along

userName <- Sys.getenv("SHINYPROXY_USERNAME")

Best,
Tobias

Hi @tverbeke

thank you very much that works perfectly!

Best
Christof