I am playing around with the keycloak (http://www.keycloak.org/) SSO framework. I want to have a central service for the user registration, password policy, OAuth2, permissions, grants, roles, login via Google, Facebook and more.
I am a RESTful API enthusiast and want to have all important services as APIs available. Thus, the GUI and application logic are properly seperated what allows me to change the GUI very easily if I like to do so. This is important to me, as we have React, Vue.js, Play, Bootstrap and more...
Furthermore, my micro-services and APIs are all behind the traefik (https://traefik.io/) load balancer.
The keycloak auth proxy that is being used in this project is maintained by https://github.com/8gears/keycloak-auth-proxy. This guy(s) is/are really responsible for the proxy auth software.
Use the scripts and knowledge in this repo when you want to play around with keycloak auth proxies. Secure your API with roles and grants configured in the keycloak SSO framework.
git clone https://github.com/ibuetler/keycloak-auth-proxy-golang.git
cd keycloak-auth-proxy
./create_docker.sh
Please adjust the following files for your environment
./config
./docker-compose.yml
docker-compose up
Please adjust the ./start_via_traefik.sh for your needs
./start_via_traefik.sh
If you don't want to 'build' the docker image, pls use the following docker hub
- example of what the upstream server receives from the auth Proxy
GET / HTTP/1.0
Host: hsr.requestcatcher.com
Connection: close
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip
Accept-Language: en-US,en;q=0.5
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJyUnJMRnl4ejhhOTh3c0V2UkRoU3c2OFBpZTRna0c0c1lfa2dDbmM1WUxrIn0.eyJqdGkiOiI2YjY5Yzk4Yy01MjU3LTRjNzQtOTFjYi0zNmE2NGMwY2YzZWQiLCJleHAiOjE1MTkyMjc2NDEsIm5iZiI6MCwiaWF0IjoxNTE5MjI3MzQxLCJpc3MiOiJodHRwczovL2F1dGguaWRvY2tlci5oYWNraW5nLWxhYi5jb20vYXV0aC9yZWFsbXMvSGFja2luZy1MYWIiLCJhdWQiOiJrZXljbG9hay1kZW1vIiwic3ViIjoiNjFiNDk0MjYtMmEzZC00NWY3LTkwMmEtMjJiMjdjYTMxY2E2IiwidHlwIjoiQmVhcmV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mraBLXT/5GwU93f5gakijwiT8XMlX+lLzzAk2opFq9hSI3F1ToA5yh/OkjorO3PzPgzTfwUvMkrsWCQBJBf0xR+PBvk+28eD0BFqBvu1ukXh1UBwZY00EIa3LC/2NeSVu0JytHd7hsTJDbhDBDjrYRgDjPpJ4+8mSWrieZPJhArMMIHKAtuL1lT8BTnpdSCusuV32qG8IgfV2psYpR7CkpnBQAiUxXVZYtyGMMTz56eECOgD1KGtRrdWqh6XdUALGG1TF6/qGa73DoS0gBncWTpqmdbhV/B14r9Y/wTVEHnQf5oYwooO35qHcKxfAKll7LwalQj/tBmfCxFkv2P8ZqQYc3wcZhYW+OTcu1aGtlFe8qV/OsnqkCa509yYYIA9hCwxokohsjzbwfM267i6O0SEojDu92Yh104X8oRc1TFcuIwaqkC2ODr0vs9rApb+w2/aUUP4T8PecgI2JscnfJ1DkO1GdVrqij40E1Jz1hy2wq+vHvCukpZuSjEEPfQk21cB/WbQ7TiYvsUsVpITFMoke7W3xSBOVNXazZ0qdqYhvsH4rMy8Ks+2n+Cf7pyCmof0/LPEdsieWH0XXBlJohDjX+1N+9zSAVnURl8EsRBJsNBBT+ZwE4q/GNZILC4
Dnt: 1
Pragma: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:58.0) Gecko/20100101 Firefox/58.0
X-Auth-Email: [email protected]
X-Auth-Expiresin: 2018-02-21 15:40:41 +0000 UTC
X-Auth-Groups:
X-Auth-Roles: glocken,uma_authorization,account:manage-account,account:manage-account-links,account:view-profile
X-Auth-Subject: 61b49426-2a3d-45f7-902a-22b27ca31ca6
X-Auth-Token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJyUnJMRnl4ejhhOTh3c0V2UkRoU3c2OFBpZTRna0c0c1lfa2dDbmM1WUxrIn0.eyJqdGkiOiI2YjY5Yzk4Yy01MjU3LTRjNzQtOTFjYi0zNmE2NGMwY2YzZWQiLCJleH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m8Yt9TnuztxQ5kkox_yBFHpiD3mSHwfDmEOKxwydHT72HSoe2olxflRN5KRAail-f5vJJwBrEO1NFUyJ1qR5yPuJXO-WPmhSVeDzI03jiX8DTnVidPB3g
X-Auth-Userid: [email protected]
X-Auth-Username: [email protected]
X-Forwarded-For: 152.96.214.217
X-Forwarded-For: 152.96.214.217
X-Forwarded-Host: hsr.requestcatcher.com
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Forwarded-Server: idocker-prod
X-Real-Ip: 152.96.214.217