This project is demonstrating how to setup authentication, authorization and access control using a brokerage. With a brokerage the authentication will be delegated to an upstream idp.
- Authentication is happening using a keycloak with this realms
- upstreamidp1 for user base 1
- upstreamidp2 for user base 2
- Authorization is happening using
- keycloak-proxy which is protecting the access to an example application
- Access Control is happening using a keycloak which acts a a broker. it is in charge of
- defining the roles for dedicated users.
- some linux distribution like Arch Linux or Debian
- docker
- docker-compose
- cfssl
The used components are used as docker container and will be started using docker-compose:
The overall architecture looks like this:
These roles are known
- application user - authenticates and is using the application
- security account manager - manages accounts in IAM systems
- security role manager - manages the roles in the broker
- developer - has developed the application and is the defining the policies for an authorization
Add necessary host entries to /etc/host file
127.0.0.1 debug.aaa.demo
127.0.0.1 app.aaa.demo
127.0.0.1 api.keycloak.aaa.demo mgmt.keycloak.aaa.demo
Run ./start.sh
It starts several services:
- postgres database
- keycloak with 4 realms https://api.keycloak.aaa.demo
- keycloak-gatekeeper https://app.aaa.demo with protects the demo application
- demo application
- httpbin for debugging https://debug.aaa.demo
- traefik as a lightweight loadbalancer
- Access http://app.aaa.demo. You will be redirected to the Broker
- Login directly at the broker or at another upstream idp. You are logged in and will be redirected back to the demo application
- Access http://api.keycloak.aaa.demo.
- login with admin user from Keycloak Master
- Go to "Manage Users" on left menu
- Select a user and click the button edit
- Go to roles tab
- admin / 11111111
- brokeruser1 / brokeruser1
- idp1user1 / idp1user1
- idp2user1 / idp2user1
- Keycloak Broker SAML SP Descriptor URL for Upstreamidp1
- Keycloak Broker SAML SP Descriptor URL for Upstreamidp2
- Keyclaok Upstreamidp1 SAML IDP Descriptor URL
- Keyclaok Upstreamidp2 SAML IDP Descriptor URL