openanalytics / shinyproxy-config-examples

Configuration examples for ShinyProxy
https://www.shinyproxy.io
147 stars 110 forks source link

Shiny Proxy - Landing Page #29

Closed jino-mariath closed 2 years ago

jino-mariath commented 2 years ago

Hello Team,

Can we have a Landing page after authentication on Shiny Proxy?

We have a requirement - If the person does not belong to the AD group that we provided inside the application.yml file then the User should get a Notification/message that - You are not authorized to access this page/contact admin. something like that.

Currently, If the user is not part of the AD group, get a white blank page.

it would be great if we can provide some message with a reason on the landing page to the user would be beneficial.

Thank you for your support.

jino-mariath commented 2 years ago

Or do we have an option to notify the access issue rather than display a blank screen?

LEDfan commented 2 years ago

Hi @jino-mariath

There is no "official" way to do this in ShinyProxy. However, you can edit the index.html templates (see: https://github.com/openanalytics/shinyproxy-config-examples/tree/master/04-custom-html-template) and add the following block of code at line 115:

<div th:if="${apps.length == 0}">
    <h1>You don't have access to this application.</h1>
</div>

The code inside the div element will be shown to users when they don't have access to any app.

Screenshot 2022-01-24 at 08-36-25 Open Analytics Shiny Proxy

jino-mariath commented 2 years ago

Thank you so much. I have updated the code on line No. 115 here -- https://github.com/openanalytics/shinyproxy/blob/master/src/main/resources/templates/index.html.
Quick question - Where do I place the file in a container and should I tell this file located in the application.yml file?

LEDfan commented 2 years ago

When using the official Docker image, you can place the file at /opt/shinyproxy/templates/index.html. Next you add the following configuration to your application.yml file:

proxy:
    template-path: templates

Make sure to "merge" the example, i.e. don't add proxy two times, but add the template-path under the existing proxy section.

Here is an example Dockerfile:

FROM openanalytics/shinyproxy:2.6.0

COPY application.yml /opt/shinyproxy/application.yml
COPY index.html /opt/shinyproxy/templates/index.html

Good luck!

jino-mariath commented 2 years ago

Excellent... Thank you so much. it worked well. Thank you.