Tech: nginx + oauth2_proxy
-
Install oauth2_proxy (https://github.com/bitly/oauth2_proxy):
$ go get github.com/bitly/oauth2_proxy
-
Set up your favourite OAuth2 provider (see https://github.com/bitly/oauth2_proxy for detailed instructions)
-
Run:
$ oauth2_proxy --client-id=CLIENT_ID --client-secret=CLIENT_SECRET --cookie-secret=COOKIE_SECRET --email-domain=pricingmonkey.com
-
Change your nginx.conf to match this gist (or just copy-paste if doing this from scratch).
-
Make sure these variables match your configuration:
- oauth2_proxy_uri
- upstream_uri
- no visible log out link (user will be logged out when they navigate to: http://ZIPKIN_URL/oauth2/sign_in).
- auth_request does not support conditional authentication. We need this to allow unauthenticated insertion of spans (POST api/v1/span). I hacked away around it, but this clearly increases complexity. (Source: https://stackoverflow.com/questions/29210428/nginx-optional-auth-request)