Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

This project contains an example Wiki application based on A gentle guide to asynchronous programming with Eclipse Vert.x for Java developers.

It is using Keycloak for authentication, with the setup described below, and Jooq for database connection, using a Postgres database with the setup described below.

You can run the example by executing the net.redpipe.example.wiki.keycloakJooq.Main class and visiting the Wiki page, which should redirect you to a login page where you can try any of the user names described below (try root/w00t for admin access).

It also contains a REST endpoint which uses JWT tokens (see tests), and an AngularJS application using that endpoint.

== Note on tests ==

The tests use Docker images to set up Keycloak and Postgres.

== Keycloak setup ==

  1. Download Keycloak Standalone Server and run it.
  2. Create the admin account with username admin and password admin.
  3. Go to the admin console and log in with admin/admin.
  4. Create a new Realm with name demo.
  5. Create a new Client with Client ID set to vertx and rootUrl set to http://localhost:9000.
  6. Once you have created the client, you're allowed to set up more properties, so stay in the page and change:
  7. Access Type to confidential
  8. Valid Redirect URIs to http://localhost:9000/callback/*
  9. Click on the Roles tab at the top
  10. Click on Add Role for the following roles:
  11. admin
  12. writer
  13. editor
  14. create
  15. update
  16. delete
  17. From the Roles tab, click Edit for the admin role
  18. Set Composite Roles to true
  19. In the bottom-most select-box named Client Roles, select vertx
  20. In the Available Roles list that appeared to the right, select create, update, delete and click on Add selected
  21. From the Roles tab, click Edit for the editor role
  22. Set Composite Roles to true
  23. In the bottom-most select-box named Client Roles, select vertx
  24. In the Available Roles list that appeared to the right, select create, update, delete and click on Add selected
  25. From the Roles tab, click Edit for the writer role
  26. Set Composite Roles to true
  27. In the bottom-most select-box named Client Roles, select vertx
  28. In the Available Roles list that appeared to the right, select create and click on Add selected
  29. From the Credentials tab, copy the Secret value and store it in the conf/config.json file in keycloak/credentials/secret.
  30. Go to the keys page and click on `Public key.
  31. Copy the displayed key and store it in the conf/config.json file in keycloak/realm-public-key.
  32. Go the users page and click on Add user
  33. Set Username to root and click Save
  34. Click on the Credentials top tab and set its password to w00t, then click Reset password
  35. Click on the Role Mappings top tab
  36. In the bottom-most select-box named Client Roles, select vertx
  37. In the Available Roles list that appeared to the right, select admin and click on Add selected
  38. Go the users page and click on Add user
  39. Set Username to foo and click Save
  40. Click on the Credentials top tab and set its password to bar, then click Reset password
  41. Click on the Role Mappings top tab
  42. In the bottom-most select-box named Client Roles, select vertx
  43. In the Available Roles list that appeared to the right, select editor, writer and click on Add selected
  44. Go the users page and click on Add user
  45. Set Username to bar and click Save
  46. Click on the Credentials top tab and set its password to baz, then click Reset password
  47. Click on the Role Mappings top tab
  48. In the bottom-most select-box named Client Roles, select vertx
  49. In the Available Roles list that appeared to the right, select writer and click on Add selected
  50. Go the users page and click on Add user
  51. Set Username to baz and click Save
  52. Click on the Credentials top tab and set its password to baz, then click Reset password

You're all set for Keycloak!

== Postgres set-up ==

  1. Install Postgres
  2. Log in as the postgres user $ sudo su - postgres
  3. Create a redpipewiki user (with redpipewiki as password): postgres $ createuser -PSRD redpipewiki
  4. Create a redpipewiki database: postgres $ createdb -O redpipewiki -E utf8 redpipewiki
  5. Log out of the postgres user: postgres $ exit
  6. Load the database schema: $ psql -h localhost -U redpipewiki redpipewiki redpipewiki=> \i redpipe-example-wiki-keycloak-jooq/db.sql

You're all set for Postgres!