Build a Docker image of container from shell command (including force remove of intermediary container) from shell command line:
docker-compose build --force-rm
Scan image vulnerabilities from shell command line:
docker scan agnet/cybnity-keycloak-distribution
Run a docker container without shell console (as a daemon without interaction) or without -d argument to maintain shell console opened from shell command line:
docker-compose up -d
When start process is executed, a Quarkus Keycloack server in development mode is executed:
Create a Realm similar to a Tenant Id relative to an organization (e.g named cybnity) from the top-left select menu with click on Create Realm button.
Set the Security defenses configuration:
Realm Settings > Cybnity > Security Defenses to configure the Clickjacking security:
SAMEORIGIN value of X-Frame-Options
frame-src 'self'; frame-ancestors 'self'; object-src 'none'; value of Content-Security-Policy
Register a new Keycloak client dedicated to proto-frontend-ui-server (allowing user authentication from web browser when access to web UI) from the administration console:
Clients and use Create button for add a new clientRegister a new Keycloak client dedicated to proto-backend-ui-server (allowing sso check by server-side during reception of Event bus messages) from the administration console:
Clients and use Create button for add a new clientCredentials section and define:
Keys section and define:
Client Scopes section and assign the “client_roles_react_app” as Assigned Default Client ScopesMappers and create a role named “roles”:
Service Account Roles section and assign “app-user” roleFrom the Installation panel (allowing download of keycloack.json setting file to store into the resources folder of proto-backend-ui-server Maven project), the Keycloak OIDC JSON file is similar to the sample:
{
"realm": "cybnity",
"auth-server-url": "http://localhost:8082/",
"ssl-required": "external",
"resource": "cybnity-backend-api",
"verify-token-audience": true,
"credentials": {
"secret": "eNnieaQ63RE33bugdVJBHXe69XcfHbEX"
},
"use-resource-role-mappings": true,
"confidential-port": 0,
"policy-enforcer": {}
}
Clients > cybnity-frontend-ui-react > Roles section, add a new standard role named “user”Clients > cybnity-backend-api > Roles section, add a new standard role named “user”Roles > Realm Roles section, add a new realm role named “app-user”
Composite Roles value to ONComposite Roles sub-panel:
By default, new created Realm has none user. Create a test account declared for a test user allowing to use the proto-frontend-ui-server web UI:
Users menu as:
Users > tester account management UI:
Details panel:
Email Verified to ON and saveCredentials panel:
Temporary to OFFSet Password buttonBy default, new created Realm has none user. Create a test account declared for a test user allowing to use the proto-frontend-ui-server web UI:
Users menu as:
Users > tester account management UI:
Details panel:
Email Verified to ON and saveCredentials panel:
Temporary to OFF for avoid password change required at first loginSet Password buttonRole Mappings panel:
If you have many applications you need to secure and register within your organization, it can become tedious to configure role scope mappings for each of these clients. Keycloak allows you to define a shared client configuration in an entity called a client scope. If we want to get client roles in a custom key in the JWT token, we have to add client scope to put client roles in access token.
Go to Client Scopes and create a new scope:
Client Scopes > client_roles_react_app > Mappers panel:Go to Clients > cybnity-frontend-ui-react > Client Scopes panel for add the custom scope previously created:
From now, we can get the client roles from the JWT token with roles key, allowing to enable/disable proto-frontend-ui-server’s view to particular roles received from the token.
When disconnected of any user account:
Personal info for try to manage personal basic informations;
From proto-front-end-ui web access, try access to Secured Screen with use of Keycloak test account.
Check that startup log contains (ensuring that desired feature is enabled) the following line:
INFO [org.key.com.Profile] (main) Preview feature enabled: token_exchange
Read logs from shell command line:
docker-compose logs -f
Kill container from shell command line:
docker-compose kill
or
docker kill agnet/cybnity-keycloak-distribution
Create tag for built container distribution specific to CYBNITY technology from shell command line:
docker tag cybnity-keycloak-distribution agnet/cybnity-keycloak-distribution:latest
Push docker image to online CYBNITY private Docker repository from shell command line:
docker push agnet/cybnity-keycloak-distribution:latest