qvest-digital / loginsrv

JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..
MIT License
1.92k stars 148 forks source link

Implement support for virtual hosts #178

Closed pedro-r-marques closed 4 years ago

pedro-r-marques commented 4 years ago

This PR adds support for a new yaml configuration file which allows different auth backend usage based on the HOST request header field.

It also adds an health-check option that can be used to specify a path where the server responds with an 200 OK. This is used when the load balancer checks the health of the backend.

Please let me know whether you would be interested in accepting this functionality.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.8%) to 90.593% when pulling 27bdba4a5bfb51f240db9b8dd95b132842a142b1 on BLPDigital:vhost-up into 7f875dc3f4bad4dd24e0ab63b362d6158d46c96e on tarent:master.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.8%) to 90.593% when pulling 27bdba4a5bfb51f240db9b8dd95b132842a142b1 on BLPDigital:vhost-up into 7f875dc3f4bad4dd24e0ab63b362d6158d46c96e on tarent:master.

g-w commented 4 years ago

Hello @pedro-r-marques,

thank you for your contribution!

First, adding a health endpoint to the service is a nice addition!

I don't think adding an additional configuration file to loginsrv is the way to go forward. This is unexpected for both use cases as a caddy plugin or as standalone software. If used as a caddy plugin the configuration should be put in the Caddyfile. If used as standalone application, the configuration should be put in arguments or environment variables.

vHost support is out of the scope of this project. Maybe running multiple instances of loginsrv (possibly behind some edge proxy, ie traefik) is a solution your use case.

I will close this PR since i will not accept most of the changes. But if you extract the changes regarding the health endpoint i will have a look at this!