org.entando.entando:entando-keycloak-auth

Entando Core Maven Parent POM

License

License

Categories

Categories

KeY Data Data Formats Formal Verification Keycloak Security
GroupId

GroupId

org.entando.entando
ArtifactId

ArtifactId

entando-keycloak-auth
Last Version

Last Version

6.2.2
Release Date

Release Date

Type

Type

war
Description

Description

Entando Core Maven Parent POM
Project URL

Project URL

https://central.entando.com/entando-keycloak-auth
Project Organization

Project Organization

Entando Inc.
Source Code Management

Source Code Management

https://github.com/entando/entando-keycloak-plugin

Download entando-keycloak-auth

How to add to project

<!-- https://jarcasting.com/artifacts/org.entando.entando/entando-keycloak-auth/ -->
<dependency>
    <groupId>org.entando.entando</groupId>
    <artifactId>entando-keycloak-auth</artifactId>
    <version>6.2.2</version>
    <type>war</type>
</dependency>
// https://jarcasting.com/artifacts/org.entando.entando/entando-keycloak-auth/
implementation 'org.entando.entando:entando-keycloak-auth:6.2.2'
// https://jarcasting.com/artifacts/org.entando.entando/entando-keycloak-auth/
implementation ("org.entando.entando:entando-keycloak-auth:6.2.2")
'org.entando.entando:entando-keycloak-auth:war:6.2.2'
<dependency org="org.entando.entando" name="entando-keycloak-auth" rev="6.2.2">
  <artifact name="entando-keycloak-auth" type="war" />
</dependency>
@Grapes(
@Grab(group='org.entando.entando', module='entando-keycloak-auth', version='6.2.2')
)
libraryDependencies += "org.entando.entando" % "entando-keycloak-auth" % "6.2.2"
[org.entando.entando/entando-keycloak-auth "6.2.2"]

Dependencies

provided (3)

Group / Artifact Type Version
org.entando.entando : entando-engine jar 6.2.16
javax.servlet : javax.servlet-api jar 3.1.0
org.projectlombok : lombok jar 1.18.2

test (8)

Group / Artifact Type Version
org.keycloak : keycloak-admin-client jar 7.0.1
org.jboss.resteasy : resteasy-client jar 3.12.1.Final
org.jboss.resteasy : resteasy-jaxrs jar 3.12.1.Final
org.jboss.resteasy : resteasy-jackson2-provider jar 3.12.1.Final
org.mockito : mockito-core jar 2.28.2
org.assertj : assertj-core jar 3.11.1
junit : junit jar 4.12
com.jayway.jsonpath : json-path-assert jar 2.2.0

Project Modules

There are no modules declared in this project.

Entando Keycloak Plugin

Keycloak Integration for Entando Core - Gives SSO capabilities and also has User Management through Keycloak.

For more information and documentation visit: https://dev.entando.org, or https://forum.entando.org. Or for the latest news or product information please visit the main website: https://www.entando.com.

Information below is for building from source or running locally as a contributor or developer on the plugin itself.. See the links above for general documentation and usage.

Scope

What this plugin does

  • Enables SSO capabilities to an Entando Instance by using Keycloak.
  • Moves User Management to Keycloak.

What this plugin does not

This plugin doesn't come with Role and Group management, because Entando Core roles/groups model isn't compatible with Keycloak. That means that even with the same users across multiple Entando Instances, the role and group mappings have to be configured on each instance.

Properties

  • keycloak.enabled: Enables this plugin. (The default is false)
  • keycloak.auth.url: It's the Keycloak auth url. Example: https://is.yourdomain.com/auth. (The default is http://localhost:8081/auth)
  • keycloak.realm: The keycloak realm. See https://www.keycloak.org/docs/3.2/server_admin/topics/overview/concepts.html . (The default is entando)
  • keycloak.client.id: The keycloak confidential client id. (The default is entando-app)
  • keycloak.client.secret: The secret from the keycloak client. (The default is <blank>)
  • keycloak.public.client.id: The second keycloak client, this one must be public. (The default is entando-web)
  • keycloak.secure.uris: [OPTIONAL] Use if you want to secure an endpoint. Works with wildcards, comma separated.
  • keycloak.authenticated.user.default.authorizations: [OPTIONAL] Use if you want to automatically assign group:role to any user that logs in, comma separated. Example: administrators:admin,readers

Installing

Installing on your project

First add the entando-keycloak-auth dependency to your pom.xml

<dependency>
    <groupId>org.entando.entando</groupId>
    <artifactId>entando-keycloak-auth</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <type>war</type>
</dependency>

Edit web.xml

To Oauth2 work properly, we have to replace the springDispatcher contextConfigLocation by replacing the regular classpath:spring/web/servlet-context.xml entry with the keycloak one classpath:spring/web/servlet-context-keycloak.xml,

Here what it should look like:

<servlet>
    <servlet-name>springDispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/web/servlet-context-keycloak.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

Edit systemParams.properties

Then you have to open the systemParams.properties to add keycloak configuration

keycloak.enabled=true
keycloak.auth.url=${KEYCLOAK_AUTH_URL:http://localhost:8081/auth}
keycloak.realm=${KEYCLOAK_REALM:entando-development}
keycloak.client.id=${KEYCLOAK_CLIENT_ID:entando-core}
keycloak.client.secret=${KEYCLOAK_CLIENT_SECRET:930837f0-95b2-4eeb-b303-82a56cac76e6}
keycloak.public.client.id=${KEYCLOAK_PUBLIC_CLIENT_ID:entando-web}
keycloak.secure.uris=/api/plugins/cms/contents/*/model/*,/api/pwa/notifications/*
keycloak.authenticated.user.default.authorizations=administrators:admin,readers

Keycloak Setup

In order to setup keycloak to work with entando instance, please refer to the documentation here https://github.com/entando/entando-keycloak-plugin/wiki/Setup-Keycloak

Keycloak Standard Flow

To enable the standard flow to keep sessions between Entando instances, please refer to the documentation here https://github.com/entando/entando-keycloak-plugin/wiki/Enable-Standard-Flow-for-Keycloak-Login

Known issues

org.apache.log4j.spi.LoggerFactory

If you run this following exception:

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/spi/LoggerFactory
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:74)
	at org.owasp.esapi.ESAPI.logFactory(ESAPI.java:137)
	at org.owasp.esapi.ESAPI.getLogger(ESAPI.java:154)
	at org.owasp.esapi.reference.DefaultEncoder.<init>(DefaultEncoder.java:75)
	at org.owasp.esapi.reference.DefaultEncoder.getInstance(DefaultEncoder.java:59)
	... 82 more

It might also be a dependency conflict, to fix this issue, add the following dependency to your pom.xml file.

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

Testing

To run unit tests:

$ mvn test

Some tests are being tested with a real Keycloak instance so, in order to test, you have to start the keycloak before.

$ docker-compose -f keycloak/docker-compose.yml up -d
$ mvn failsafe:integration-test
org.entando.entando

Entando Inc

Open source micro frontend platform for Kubernetes.

Versions

Version
6.2.2
6.1.2
6.1.1
6.1.0
5.3.2
5.2.0
5.1.3
5.1.2
5.1.1
5.1.0