Integrating Keycloak With SonarQube

sonar-keycloak
You can grab the plugin here

Step 1: Create a Realm
ks1

Step 2: Create An Application

ks2

Step 3: Copy the keycloak.json

ks3

Step 4: Replace the new lines in json file

ks4

Step 5:  Configure Sonar

ks5

Step 6:  Copy the Plugin to Sonar Extensions

ks6

Step 7:  Login to Sonar

ks7

Step 8: You would be redirected to Keycloak

ks8

Step 9: Successful Login

ks9

Refer this if you would like to integrate Keycloak with Jenkins

Deploying Keycloak In TomEE

We would be using apache-tomee-plus-1.7.1 and Keycloak 1.1.0.Beta2

Refer this blog first Deploying Keycloak In Tomcat

Step 1: Configure TomEE for Hibernate instead of OpenJPA

Follow the guidelines here  to configure Hibernate

kte1

kte3

Step 2 : Configure TomEE with DataSource

Follow the guidelines here  and here to configure datasource

Since we would be using H2 database, copy h2-1.3.176.jar to TOMEE_HOME/lib

Modify the TOMEE_HOME/conf/tomee.xml as follows

kte2

Step 3 : Configure the Keycloak Server

Download the keycloak-server from github

Change the datasource name as follows

For TomcatEE external JNDI name starts with java:comp (Not  java:comp/env as is Pure Tomcat)

kte4

Deploy to TomEE and start the server, you would get the following error

kte5

Step 4 : Fix the issues

Create the policyConfgi.xml as follows

kte6

Step 5 : Have fun

Login to app with admin/admin

kte7