Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update keycloak-principal-transformer for EE 10 and WFLY 27.0.1.Final #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions keycloak-principal-transformer/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Implementing and making use of a custom-principal-transformer
Implementing and making use of a custom-principal-transformer
=============================================================

This example demonstrates how to implement and make use of a simple principal transformer that converts a KeycloakPrincipal to a NamePrincipal.
Expand All @@ -13,7 +13,7 @@ Compile:
Add a module that contains our custom principal transformer:

bin/jboss-cli.sh
module add --name=org.wildfly.security.examples.keycloak-principal-transformer --resources=/PATH_TO_ELYTRON_EXAMPLES/elytron-examples/keycloak-principal-transformer/target/keycloak-principal-transformer-1.0.0.Alpha1-SNAPSHOT.jar --dependencies=org.wildfly.security.elytron,org.wildfly.extension.elytron,org.keycloak.keycloak-core
module add --name=org.wildfly.security.examples.keycloak-principal-transformer --resources=/PATH_TO_ELYTRON_EXAMPLES/elytron-examples/keycloak-principal-transformer/target/keycloak-principal-transformer-2.0.0.Alpha1-SNAPSHOT.jar --dependencies=org.wildfly.security.elytron,org.wildfly.extension.elytron,org.keycloak.keycloak-adapter-subsystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check, why was this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

org.keycloak.keycloak-core isn't a default server module anymore, while the keycloak-adaptor-subsystem is available. Tested this configuration and the demo ran properly.

Copy link
Contributor

@fjuma fjuma Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

org.keycloak.keycloak-core wasn't provided by default before. Previously, this example was meant to be used with the Keycloak OIDC adapter. The keycloak-adapter-subsystem is something that was introduced only for migration purposes, it doesn't provide the KeycloakPrincipal class that's used by the custom transformer. I think the steps in the example don't actually make use of the transformer after configuring it. Will take a closer look later to see if we should remove this example or update it a different way.


Add a ```custom-principal-transformer``` in the Elytron subsystem that references this new module and our custom principal transformer class that is contained in this module:

Expand Down
11 changes: 6 additions & 5 deletions keycloak-principal-transformer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
<version>2.0.0.Alpha1-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<version.org.wildfly.security.wildfly-elytron>1.15.14.Final</version.org.wildfly.security.wildfly-elytron>
<version.org.wildfly.core>15.0.1.Final</version.org.wildfly.core>
<version.org.keycloak.keycloak-core>20.0.3</version.org.keycloak.keycloak-core>
<version.org.wildfly.security.wildfly-elytron>2.0.0.Final</version.org.wildfly.security.wildfly-elytron>
<version.org.wildfly.core>19.0.1.Final</version.org.wildfly.core>
</properties>

<dependencies>
Expand All @@ -29,7 +30,7 @@
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>18.0.0</version>
<version>${version.org.keycloak.keycloak-core}</version>
</dependency>
</dependencies>

Expand Down