Skip to content

Commit

Permalink
Merge pull request #1 from intensiongmbh/extension
Browse files Browse the repository at this point in the history
Create initial keycloak extension structure.
  • Loading branch information
ingokuba authored Mar 12, 2021
2 parents f462566 + 795d9df commit e735157
Show file tree
Hide file tree
Showing 7 changed files with 327 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
release:
types:
- created
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_SECRET }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Publish package
run: mvn --batch-mode deploy -DskipTests -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dkeycloak.version=${GITHUB_REF##*/} -Dchangelist=
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.7'
services:
keycloak:
container_name: keycloak-sendinblue
image: jboss/keycloak:{{ KEYCLOAK_VERSION }}
ports:
- 18080:8080
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: keycloak
volumes:
- /etc/localtime:/etc/localtime:ro
- ./target/keycloak-sendinblue-{{ KEYCLOAK_VERSION }}.jar:/opt/jboss/keycloak/standalone/deployments/keycloak-sendinblue.jar
247 changes: 247 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<groupId>de.intension</groupId>
<artifactId>keycloak-sendinblue</artifactId>
<version>${keycloak.version}${changelist}</version>
<packaging>jar</packaging>

<name>Keycloak Sendinblue</name>
<description>Keycloak addon to use the Sendinblue API for sending mails</description>
<url>https://github.com/intensiongmbh/keycloak-sendinblue</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Ingo Kuba</name>
<email>[email protected]</email>
<url>https://github.com/ingokuba</url>
<organization>intension GmbH</organization>
<organizationUrl>https://www.intension.de/</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/intensiongmbh/keycloak-sendinblue.git</connection>
<developerConnection>scm:git:ssh://github.com:intensiongmbh/keycloak-sendinblue.git</developerConnection>
<url>https://github.com/intensiongmbh/keycloak-sendinblue/tree/master</url>
</scm>

<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<properties>
<keycloak.version>12.0.2</keycloak.version>
<changelist>-SNAPSHOT</changelist>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<lombok.version>1.18.18</lombok.version>
<maven.test-plugins.version>2.22.2</maven.test-plugins.version>
<junit-jupiter.version>5.7.1</junit-jupiter.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi-private</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.test-plugins.version}</version>
<configuration>
<argLine>
--illegal-access=permit -Xmx1024m -XX:MaxPermSize=256m
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.test-plugins.version}</version>
<configuration>
<argLine>
--illegal-access=permit
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Dependencies>org.keycloak.keycloak-core, org.keycloak.keycloak-server-spi, org.keycloak.keycloak-server-spi-private, org.keycloak.keycloak-services,
org.jboss.logging</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
11 changes: 11 additions & 0 deletions src/main/resources/jboss-deployment-structure.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.keycloak.keycloak-core" />
<module name="org.keycloak.keycloak-server-spi" />
<module name="org.keycloak.keycloak-server-spi-private" />
<module name="org.keycloak.keycloak-services" />
</dependencies>
</deployment>
</jboss-deployment-structure>
16 changes: 16 additions & 0 deletions src/test/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# build jar without SNAPSHOT suffix
mvn clean package -DskipTests -Dchangelist=
if [[ "$?" -ne 0 ]] ; then
echo 'could not run maven package'; exit $rc
fi
# get keycloak version from pom
KEYCLOAK_VERSION=$(mvn help:evaluate -Dexpression=keycloak.version -q -DforceStdout)
# save file content
dockerComposeFile=$(<docker-compose.yml)
# replace keycloak version for docker
sed -i "s/{{ KEYCLOAK_VERSION }}/$KEYCLOAK_VERSION/g" docker-compose.yml
# start docker
docker-compose up --build --detach
# revert file contents to original state
echo "$dockerComposeFile" > docker-compose.yml
12 changes: 12 additions & 0 deletions src/test/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# get keycloak version from running container
keycloakImage=$(docker inspect keycloak-sendinblue -f '{{.Config.Image}}')
keycloakVersion="${keycloakImage#*:}"
# save file content
dockerComposeFile=$(<docker-compose.yml)
# replace keycloak version for docker
sed -i "s/{{ KEYCLOAK_VERSION }}/$keycloakVersion/g" docker-compose.yml
# stop docker
docker-compose down -v
# revert file contents to original state
echo "$dockerComposeFile" > docker-compose.yml

0 comments on commit e735157

Please sign in to comment.