Thursday, 19 April 2018
Keycloak Questionnaire
Thursday, 22 March 2018
Keycloak 4.0.0.Beta1 Released
I'm very pleased to announce the first release of Keycloak 4!
To download the release go to the Keycloak homepage.
Highlights
Brand new login pages
The login pages have received a brand new look. They now look much more modern and clean!
UMA 2.0
Authorization Services have now introduced support for UMA 2.0 and added support for users to manage user access through the account management console. There's also a number of other additions and improvements to authorization services.
Themes and Theme Resources
It's now possible to hot-deploy themes to Keycloak through a regular provider deployment. We've also added support for theme resources. Theme resources allows adding additional templates and resources without creating a theme. Perfect for custom authenticators that require additional pages added to the authentication flow.
We've also added support to override the theme for specific clients. If that doesn't cover your needs, then there's a new Theme Selector SPI that allows you to implement custom logic to select the theme.
Native promise support to keycloak.js
The JavaScript adapter now supports native promises. Of course it still has support for the old style promises as well. Both can be used interchangeably.
Edit links in documentation
To make it easier to contribute changes to the documentation we have added links to all sections of the documentation. This brings you straight to the GitHub editor for the relevant AsciiDoctor file. There's also a quick link to report an issue on a specific page that will include the relevant page in the description.
HTTPS support on keycloak.org
Thanks to GitHub pages and Let's Encrypt there's finally HTTPS on keycloak.org. About time?
Loads more..
The full list of resolved issues is available in JIRA.
Upgrading
Before you upgrade remember to backup your database and check the upgrade guide for anything that may have changed.
Monday, 26 February 2018
Keycloak and Istio
Keycloak and Istio
What is Istio ?
The end of the adapters ?
The Envoy Sidecar
Envoy Filters
The JWT-Auth Filter
The Keycloak-Istio Demo
- A Keycloak Pod : a pod containing a Keycloak Server.
- A Web App Pod (Cars Web): this pod contains the Web App that will perform the authentification through the Keycloak login in order to obtain a JWT token
- Then we have the Istio related components :
- The Pilot to configure the Envoy proxies
- The Mixer to handle the attributes returned by Envoy
- The API Service (Cars API) : this pod will have two containers :
- The API service itself, in this case a simple Spring Boot Application
- The Envoy Side-Car container
- We indicate what needs to be configured, the kind of policy and implicitly the correct filter (in our case the jwt-auth filter) will be configured.
- It needs to know where to retrieve Keycloak's Public key in order to verify the JWT signature.
- The issuer : who has generated the token ? In this case it's also the Keycloak Server.
Friday, 9 February 2018
Keycloak and Angular CLI
If you want to try it out, do this from the command line:
> npm install -g @ssilvert/keycloak-schematic
> ng new myApp
> cd myApp
> ng generate keycloak --collection @ssilvert/keycloak-schematic --clientId=myApp
Now Keycloak is integrated into your app. Of course, you can do this with any existing Angular CLI application. It doesn't have to be a new one.
Then, go to the Keycloak Admin console (master realm) and go to Clients --> Add Client --> Select File.
Select the client-import.json file that the "ng generate keycloak" command created in /myApp.
Assuming your Keycloak server is running on localhost:8080, you are ready to go. Start your application:
> ng serve
Go to your browser to start the app and see this:
Oh joy! myApp is protected with Keycloak!
The keycloak-schematic installs a KeycloakService and a KeycloakGuard. So you can easily:
- Add login/logout buttons
- Access user self service (account management)
- Guard protected routes instead of the whole app
- Work with roles
- Lots more
Note that this stuff is early alpha right now. And it will move from @ssilvert to @keycloak before long. In the mean time, I'd love to get feedback. There is a lot to do to make Keycloak/Angular integration even better, but I think the keycloak-schematic is a big step forward.
So long, and thanks for all the fish.
Stan
Monday, 15 January 2018
Keycloak Cross Data Center Setup in AWS
Sample Keycloak Cross Data Center Setup in AWS Environment
It is strongly recommended to use version 3.4.3.Final at minimum as there were several important fixes done around cross-DC support since the first cross-DC-capable version.
Architecture
Example
- VPC stack. This stack creates a new VPC with four subnets: two of them in one availability zone, another two in another availability zone. One of the subnet in each availability zone is private, intended for Keycloak instances; the other subnet in each availability zone is intended for load balancer and Infinispan (so that these can communicate over the internet).
The only parameter in this stack is the number B in VPC IP address range 10.B.0.0/16.
Click the button below to launch this stack:
- Database and AMI stack. This stack creates an RDS Aurora MySQL-compatible database instance, builds Keycloak from source, creates S3 buckets necessary for dynamic node discovery via S3_PING protocol, and produces AMI image that contains both Keycloak and Infinispan preconfigured to form appropriate clusters. It relies on AWS Lambda-backed custom resources, so in order to create them, it is required that this template creates a role for these Lambdas. To launch this template, it is hence required that the user grants the CAPABILITY_IAM capability.
Both Keycloak and Infinispan server are prepared just the same way as for running cross-DC tests, and then are placed into /opt/tests path and the relevant part of their configuration is updated to suit AWS deployment.
This template has several parameters, most of them are self-describing:
- VPC stack name: Name of the stack created in the previous step
- Instance type for building image
- Database instance type: Type of the database as available in RDS
- Install diagnostic tools: Flag signalling whether the diagnostic tools should be installed
- URL to Maven repository for build: To speed up build, instead of downloading each Maven artifact, URL with a .zip file containing the whole $HOME/.m2 directory can be provided that would be unpacked prior to the actual build and provide the artifacts, thus speeding the build up.
- Keycloak Git repository and Git tag/branch/commit: Git repository and tag from which the build should start.
Click the button below to launch this stack:
- Keycloak deployment stack. This stack creates instantiates one Infinispan node in public subnet per data center, given number of Keycloak servers in private subnet joined in the cluster in each data center, and an AWS Application load balancer to spread the load between the actual Keycloak servers. If not restoring database from backup, it also creates an initial user admin with password admin in master realm, and also configures master realm to permit insecure http access to the admin console (remember, it is only a test instance, don't do this in production!).
This template has several parameters, most of them are self-describing:
- AMI stack name: Name of the stack created in the previous step
- Keycloak instances per data centre: Number of Keycloak nodes per data center
- Instance type for Keycloak servers
- Instance type for Infinispan servers
- SSH key name: Name of EC2 ssh key used for instance initialization
- Load balancer scheme: This settings determines whether the load balancer would be assigned a public or private IP only. See AWS documentation for further information.
- Database backup URL: In case you have a dump of Keycloak MySQL/MariaDB database, you can initialize the database with it by providing URL to that dump. The dump might be optionally gzipped, .gz suffix of that dump is then mandatory.
Click the button below to launch this stack:
Connecting to nodes
- On your local host, add your AWS ssh key to agent:
ssh-add /path/to/my/aws_ssh_key - Now ssh to the Infinispan host with ssh adding the ForwardAgent option:
ssh -oForwardAgent=yes \ec2-user@${InfinispanServerDcX.PublicDnsName} - From the Infinispan host, you can now ssh to the Keycloak node:
ssh ec2-user@${KeycloakServerDcX.PrivateDnsName}
Connecting to Infinispan JConsole
Now it is necessary to add an Infinispan management user so that it is possible to fill in JConsole credentials:
- Remote Process: service:jmx:remote+http://localhost:19990
- Username: admin
- Password: pwd
Disclaimer
Troubleshooting AWS specifics
- Node discovery in both Keycloak and Infinispan cluster in AWS is handled by S3_PING protocol. This protocol however can operate only in regions that support Version 2 signatures due to this JGroups bug. See Amazon documentation on S3 endpoints for regions that support Version 2 signatures. Note that it might be possible to use new NATIVE_S3_PING protocol but this one has not yet been incorporated into Keycloak due to this WildFly issue. As a workaround, you might be able to use other discovery protocol, e.g. JDBC_PING.
- The recommended database products for cross-DC deployments are only those listed in the documentation (currently Oracle Database 12c RAC and Galera cluster for MariaDB). It is possible to use ones available from Amazon RDS service. The templates from this blog are only ready for MySQL/MariaDB databases.
- It is possible to use Amazon ALB for load balancing when the related target group is set to support Load balancer stickiness. ALB uses proprietary load balancer cookie and ignores routes set in Keycloak cookies, hence adding the route to cookie should be disabled in Keycloak configuration.
Thursday, 4 January 2018
Keycloak, Apache and OpenID Connect
mod_auth_openidc makes it easy to secure your applications running in Apache or when Apache is used as a reverse proxy. It can be used both for enabling SSO to web applications as well as to secure RESTful services. For more details check out our documentation as well as the guides from mod_auth_openidc.
Keycloak 3.4.3.Final released
We've just released Keycloak 3.4.3.Final.
To download the release go to the Keycloak homepage.
The full list of resolved issues is available in JIRA.
Upgrading
Before you upgrade remember to backup your database and check the upgrade guide for anything that may have changed.







