sutch / kat

Keycloak Analysis Tool (Kat) assists with understanding the workings of Keycloak.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kat

Kat, the Keycloak Analysis Tool, assists with understanding the workings of Keycloak.

Kat provides information about the Keycloak database structure.

Limitations

This tool has been developed and tested against the following components.

  • Keycloak version 5.0.0
  • MariaDB database version 10.3
  • phpMyAdmin version 4.6 (to export the Keycloak database structure)

Installation

Add this line to your application's Gemfile:

gem 'kat'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kat

Usage

Obtain database structure

From phpMyAdmin:

  1. keycloak database
  2. Export tab
    1. Export method: Custom - display all possible options
    2. Tables:
      1. all tables should have Structure checked
      2. all tables should have Data unchecked
    3. Output: Save output to a file
      1. Character set of the file: utf-8
      2. Compression: none
    4. Format specific options: Display comments
    5. Object creation options: only the following items should be checked:
      • AUTO_INCREMENT value (under Add CREATE TABLE statement)
      • Enclose table and column names with backquotes
    6. "Go" button to download the SQL file

Test processing of database structure

To test processing of an SQL file generated by a myPhpAdmin export of the database structure, use the following command.

$ kat read sample/keycloak-5.0.0-mariadb-phpmyadmin.sql --log_level INFO

where keycloak.sql is the SQL file generated by myPhpAdmin. The log_level parameter can be used to receive additional log information (default is WARN; see Logger documentation for additional values.)

If no errors are encountered, kat will display the number of tables and constraints found.

Describe database structure

To see the tables and constraints, use the following command.

$ kat read sample/keycloak-5.0.0-mariadb-phpmyadmin.sql --log_level ERROR

Limitations

  1. The SQL processor does not support constraints containing multiple foreign keys or multiple references. The Keycloak database as of version 5.0.0 does not use such constraints.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sutch/kat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Kat project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Keycloak Analysis Tool (Kat) assists with understanding the workings of Keycloak.

License:MIT License


Languages

Language:Ruby 99.1%Language:Shell 0.9%