Skip to content

Commit

Permalink
HAWKULAR-194 - Added support for consuming Keycloak events
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrohling committed Jun 26, 2015
1 parent 7ba6d71 commit 8b48bc7
Show file tree
Hide file tree
Showing 34 changed files with 1,454 additions and 11 deletions.
39 changes: 38 additions & 1 deletion dist/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!-- Base dir required for use in wildfly-maven-plugin -->
<includeBaseDirectory>true</includeBaseDirectory>
<dependencySets>
<!-- our backend -->
<!-- the main backend -->
<dependencySet>
<outputDirectory>standalone/deployments</outputDirectory>
<includes>
Expand All @@ -41,6 +41,20 @@
<directoryMode>0755</directoryMode>
<fileMode>0755</fileMode>
</dependencySet>
<!-- the events backend -->
<dependencySet>
<outputDirectory>standalone/deployments</outputDirectory>
<includes>
<include>org.hawkular.accounts:hawkular-accounts-events-backend:war</include>
</includes>
<outputFileNameMapping>hawkular-accounts-events-backend.war</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
<useProjectAttachments>false</useProjectAttachments>
<useTransitiveDependencies>false</useTransitiveDependencies>
<useTransitiveFiltering>false</useTransitiveFiltering>
<directoryMode>0755</directoryMode>
<fileMode>0755</fileMode>
</dependencySet>
<!-- Keycloak theme -->
<dependencySet>
<outputDirectory>modules/org/hawkular/keycloak/theme/main</outputDirectory>
Expand All @@ -53,6 +67,29 @@
<useTransitiveDependencies>false</useTransitiveDependencies>
<useTransitiveFiltering>false</useTransitiveFiltering>
</dependencySet>
<!-- Keycloak Event Listeners -->
<dependencySet>
<outputDirectory>modules/org/hawkular/keycloak/events/rest/main</outputDirectory>
<includes>
<include>org.hawkular.accounts:hawkular-accounts-keycloak-event-listener-rest:jar</include>
</includes>
<outputFileNameMapping>hawkular-accounts-keycloak-event-listener-rest.jar</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
<useProjectAttachments>false</useProjectAttachments>
<useTransitiveDependencies>false</useTransitiveDependencies>
<useTransitiveFiltering>false</useTransitiveFiltering>
</dependencySet>
<dependencySet>
<outputDirectory>modules/org/hawkular/keycloak/events/jms/main</outputDirectory>
<includes>
<include>org.hawkular.accounts:hawkular-accounts-keycloak-event-listener-jms:jar</include>
</includes>
<outputFileNameMapping>hawkular-accounts-keycloak-event-listener-jms.jar</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
<useProjectAttachments>false</useProjectAttachments>
<useTransitiveDependencies>false</useTransitiveDependencies>
<useTransitiveFiltering>false</useTransitiveFiltering>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
Expand Down
18 changes: 18 additions & 0 deletions dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,30 @@
<version>1.0.7-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hawkular.accounts</groupId>
<artifactId>hawkular-accounts-events-backend</artifactId>
<version>1.0.7-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hawkular.accounts</groupId>
<artifactId>hawkular-accounts-keycloak-theme</artifactId>
<version>1.0.7-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hawkular.accounts</groupId>
<artifactId>hawkular-accounts-keycloak-event-listener-rest</artifactId>
<version>1.0.7-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hawkular.accounts</groupId>
<artifactId>hawkular-accounts-keycloak-event-listener-jms</artifactId>
<version>1.0.7-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-modules</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" ?>
<!--
Copyright 2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<module xmlns="urn:jboss:module:1.1" name="org.hawkular.keycloak.events.jms">
<resources>
<resource-root path="hawkular-accounts-keycloak-event-listener-jms.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.jms.api"/>
<module name="org.keycloak.keycloak-core"/>
<module name="org.keycloak.keycloak-model-api"/>
<module name="org.keycloak.keycloak-events-api"/>
</dependencies>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" ?>
<!--
Copyright 2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<module xmlns="urn:jboss:module:1.1" name="org.hawkular.keycloak.events.rest">
<resources>
<resource-root path="hawkular-accounts-keycloak-event-listener-rest.jar"/>
</resources>
<dependencies>
<module name="org.keycloak.keycloak-core"/>
<module name="org.keycloak.keycloak-model-api"/>
<module name="org.keycloak.keycloak-events-api"/>
</dependencies>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"accountTheme" : "hawkular",
"adminTheme" : "hawkular",
"defaultRoles" : [ "user" ],
"eventsListeners" : [ "hawkular-jms", "jboss-logging" ],
"users" : [ {
"id" : "28026b36-8fe4-4332-84c8-524e173a68bf",
"username" : "jdoe",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"providers": [
"classpath:${jboss.server.config.dir}/providers/*"
"classpath:${jboss.server.config.dir}/providers/*",
"module:org.hawkular.keycloak.events.rest",
"module:org.hawkular.keycloak.events.jms"
],

"eventsListener": {
"hawkular-rest": {
"excludes": [ "REFRESH_TOKEN", "CODE_TO_TOKEN", "LOGIN" ]
},
"hawkular-jms": {
"excludes": [ "REFRESH_TOKEN", "CODE_TO_TOKEN", "LOGIN" ]
}
},

"admin": {
"realm": "master"
},
Expand Down
53 changes: 53 additions & 0 deletions dist/src/main/xslt/standalone.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@
<xsl:attribute name="name">keycloak.import</xsl:attribute>
<xsl:attribute name="value">&#36;{jboss.home.dir}/standalone/configuration/hawkular-realm.json</xsl:attribute>
</property>
<property>
<xsl:attribute name="name">hawkular.events.listener.rest.endpoint</xsl:attribute>
<xsl:attribute name="value">http://localhost:8080/hawkular-accounts-events-backend/events</xsl:attribute>
</property>
</system-properties>
</xsl:template>

<xsl:template match="node()[name(.)='extensions']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.jboss.as.messaging"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
<extension module="org.keycloak.keycloak-server-subsystem"/>
</xsl:copy>
Expand Down Expand Up @@ -80,6 +85,17 @@
</cache-container>
</xsl:template>

<!-- Add MDB support for Hawkular Accounts -->
<xsl:template match="node()[name(.)='session-bean'][1]">
<xsl:copy>
<xsl:copy-of select="node()|@*"/>
</xsl:copy>
<mdb>
<resource-adapter-ref resource-adapter-name="hornetq-ra.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
</xsl:template>

<xsl:template match="node()[name(.)='profile']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
Expand Down Expand Up @@ -109,6 +125,43 @@
<credential name="secret"><xsl:value-of select="$uuid.hawkular.accounts.backend" /></credential>
</secure-deployment>
</subsystem>
<subsystem xmlns="urn:jboss:domain:messaging:3.0">
<hornetq-server>
<connectors>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
<!-- Global JNDI entry used to provide a default JMS Connection factory to EE application -->
<entry name="java:jboss/DefaultJMSConnectionFactory"/>
<entry name="java:/HawkularBusConnectionFactory"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-topic name="HawkularAccountsEvents">
<entry name="java:/topic/HawkularAccountsEvents"/>
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
</xsl:copy>
</xsl:template>
<xsl:template match="node()[name(.)='security-domains']">
Expand Down
74 changes: 74 additions & 0 deletions events-backend/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.hawkular.accounts</groupId>
<artifactId>hawkular-accounts-parent</artifactId>
<version>1.0.7-SNAPSHOT</version>
</parent>

<name>Hawkular - Accounts - Events Backend</name>
<artifactId>hawkular-accounts-events-backend</artifactId>
<packaging>war</packaging>

<description>
Backend for processing Accounts events, including Keycloak events.
</description>

<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.jms</groupId>
<artifactId>jboss-jms-api_2.0_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Loading

0 comments on commit 8b48bc7

Please sign in to comment.