Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShinyProxy behind a trusted authenticating proxy #297

Open
mattinbits opened this issue May 12, 2021 · 2 comments
Open

ShinyProxy behind a trusted authenticating proxy #297

mattinbits opened this issue May 12, 2021 · 2 comments

Comments

@mattinbits
Copy link

I am planning to run ShinyProxy behind a reverse proxy which authenticates the user and makes the user's ID and group information available in HTTP headers added to the request. I think I can use authentication: none to instruct ShinyProxy to trust the incoming requests from the proxy, but ideally I would also like ShinyProxy to adopt the user and group information from the HTTP headers. This would allow, for example, to restrict access to different apps based on group membership.

Is this possible in the current version of ShinyProxy? If not, is it a feature that would be considered? I could look into contributing if there is consensus on the validity of the feature.

@LEDfan
Copy link
Member

LEDfan commented May 17, 2021

Hi

This is currently not possible. I think this is a common feature in other web-applications, so I do see the value of this. In addition it should be able to nicely integrate this in the existing code.

A PR implementing this is always welcome. Here are a few notes to get you started:

  • you'll have to implement a custom IAuthenticationBackend. This is custom class of ContainerProxy.
  • you'll have to add this class to the factory.
  • in order to implement the login logic, I think you should create a OncePerRequestFilter which parses the headers and extract the necessary information from it. Then there are two options 1) you already create an Authentication object or 2) you add the information to the session of the user. I'm not sure which option is the best option, maybe this will become clear when actually implementing this option.
  • in the custom authentication backend you add a custom AuthentiationProvider:
@Override
   public void configureAuthenticationManagerBuilder(AuthenticationManagerBuilder auth) throws Exception {
           auth.authenticationProvider(customAuthentcationProvider);        
   }

If you have something working (or you are stuck), you can open a PR and we can discuss the next steps. Good luck!

@raulbla
Copy link

raulbla commented Oct 14, 2023

Please have a look at openanalytics/containerproxy#81 and let me know if the approach may work.
I have tested it with apache as RP and it looks working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants