Skip to content

Commit

Permalink
MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Dec 11, 2024
1 parent d08f70a commit d760ba0
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 383 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
8 changes: 0 additions & 8 deletions Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions Dockerfile.dev

This file was deleted.

97 changes: 4 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,5 @@
# THIS IS NOW BUILT INTO KEYCLOAK 26.0.0! 🥳
# keycloak-admin-events-logger

# keycloak-theme-additional-info-extension
Provides Password Policy data as well as Realm attribute access to your Keycloak FreeMarker templates.

## Usage

### Password Policy
The Password Policy data is available in the `passwordPolicies` object.
The following properties are available:
- `length`: The minimum length of the password
- `maxLength`: The maximum length of the password
- `digits`: The minimum number of digits required in the password
- `lowerCase`: The minimum number of lowercase characters required in the password
- `upperCase`: The minimum number of uppercase characters required in the password
- `specialChars`: The minimum number of special characters required in the password
- `notUsername`: Whether the password can contain the username
- `notEmail`: Whether the password can contain the email address
- `passwordHistory`: The number of previous passwords that cannot be reused
- `forceExpiredPasswordChange`: The number of days before the password expires

### Realm Attributes
The Realm attributes are available in the `realmAttributes` object.
This is useful
for storing information about your Realm instance that you want to display in your templates.
For example,
you could store the name of your organization in a Realm attribute and display it in your templates.

## Installation

### Manual Installation
1. Download the latest release from the [releases page](https://github.com/jcputney/keycloak-theme-additional-info-extension/releases) and place it in the `$KEYCLOAK_HOME/providers` directory of your Keycloak installation.
2. Run the following command to build the providers into Keycloak:
```bash
$KEYCLOAK_HOME/bin/kc.sh build
```
3. Start Keycloak

### Docker Installation
1. Create a Dockerfile with the following contents (or use the `Dockefile.dev` file in this repository):
```dockerfile
FROM maven:3-amazoncorretto-17 AS extensions
WORKDIR /app
COPY pom.xml .
COPY src src
RUN mvn package
FROM quay.io/keycloak/keycloak:23.0 AS builder
# Install any custom providers here
COPY --from=extensions /app/target/keycloak-theme-additional-info-extension.jar /opt/keycloak/providers/
RUN /opt/keycloak/bin/kc.sh build
FROM quay.io/keycloak/keycloak:23.0
COPY --from=builder /opt/keycloak/ /opt/keycloak/
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
```

2. Build the Docker image:
```bash
docker build -t keycloak-theme-additional-info-extension .
```

3. Run the Docker image:
```bash
docker run -p 8080:8080 keycloak-theme-additional-info-extension start-dev
```

### Dockerfile COPY Installation
1. Create a Dockerfile with the following contents:
```dockerfile
FROM quay.io/keycloak/keycloak:23.0
COPY --from=ghcr.io/jcputney/keycloak-theme-additional-info-extension:latest /app/keycloak-theme-additional-info-extension.jar /opt/keycloak/providers/
RUN /opt/keycloak/bin/kc.sh build
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
```
2. Build the Docker image:
```bash
docker build -t keycloak-theme-additional-info-extension .
```
3. Run the Docker image:
```bash
docker run -p 8080:8080 keycloak-theme-additional-info-extension start-dev
```
```bash
mvn clean install
```
182 changes: 30 additions & 152 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,170 +1,48 @@
<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/maven-v4_0_0.xsd">
<?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>dev.jcputney</groupId>
<artifactId>keycloak-theme-additional-info-extension</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>

<description>Keycloak Theme Additional Info Extension - Provides additional variables to templates, specifically for use during client-side password validation</description>

<url>https://github.com/jcputney/keycloak-theme-additional-info-extension</url>

<developers>
<developer>
<name>Jonathan Putney</name>
<email>[email protected]</email>
<organization>dev.jcputney</organization>
<organizationUrl>https://github.com/jcputney</organizationUrl>
</developer>
</developers>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/jcputney/keycloak-theme-additional-info-extension/issues</url>
</issueManagement>

<scm>
<connection>scm:git:git://github.com/jcputney/keycloak-theme-additional-info-extension.git</connection>
<developerConnection>scm:git:git://github.com/jcputney/keycloak-theme-additional-info-extension.git</developerConnection>
<url>https://github.com/jcputney/keycloak-theme-additional-info-extension</url>
</scm>

<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<groupId>org.keycloakify.keycloak</groupId>
<artifactId>keycloak-admin-events-logger</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.java.package>dev.jcputney.keycloak.extensions</main.java.package>
<keycloak.version>23.0.2</keycloak.version>
<java.version>11</java.version>
</properties>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<finalName>keycloak-theme-additional-info-extension</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<debug>true</debug>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<!-- This is required since we need to add the jboss module references
to the resulting jar -->
<manifestEntries>
<!-- Adding explicit dependencies to avoid class-loading issues at runtime -->
<Dependencies>
<![CDATA[org.keycloak.keycloak-common,org.keycloak.keycloak-core,org.keycloak.keycloak-server-spi,org.keycloak.keycloak-server-spi-private,org.keycloak.keycloak-services]]></Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<!-- keycloak deps -->
<!-- Keycloak Server dependencies -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
<artifactId>keycloak-core</artifactId>
<version>26.0.0</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi-private</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
<artifactId>keycloak-server-spi</artifactId>
<version>26.0.0</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<version>${keycloak.version}</version>
<scope>provided</scope>
<artifactId>keycloak-server-spi-private</artifactId>
<version>26.0.0</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>github</id>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/jcputney/keycloak-theme-additional-info-extension</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>central</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.4.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

This file was deleted.

This file was deleted.

Loading

0 comments on commit d760ba0

Please sign in to comment.