Hello,
i tried to integrate keycloak Spring Security Adapter and Multi Tenancy
but i encountered some problems.
I followed the guide step by step:
1. I installed keycloak on server and runned it in standalone mode on port 8180.
2. I added the dependency in pom file:
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-security-adapter</artifactId>
<version>4.4.0.Final</version>
</dependency>
Because my spring app is a old spring app, i prefer use the xml configure to manage the
security.
I created keycloakApplicationContext.xml with the configuration describe in the guide
(attached keycloakApplicationContext.xml file).
The guide continue introduce the Multi tenancy:
The Keycloak Spring Security adapter also supports multi tenancy. Instead of injecting
AdapterDeploymentContextFactoryBean with the path to keycloak.json you can inject an
implementation of the KeycloakConfigResolver interface. More details on how to implement
the KeycloakConfigResolver can be found in Multi Tenancy.
3. Then, to implement the Multi tenancy i followed the section:
I created the PathBasedKeycloakConfigResolver java class (attached
PathBasedKeycloakConfigResolver.java file) and added rows in web.xml file (attached
web.xml file).
In the previous point, the guide describe that:
Instead of injecting AdapterDeploymentContextFactoryBean with the path to keycloak.json
you can inject an implementation of the KeycloakConfigResolver interface. More details on
how to implement the KeycloakConfigResolver can be found in Multi Tenancy
But in the Multi Tenancy section i didn't found the istructions to do that.
In the web.xml i specify the path to keycloak.json and it is required to create the bean.
If i delete it the app when starting will will go to error.
What do i do to use Multi Tenancy?
Thanks to all
Mattia Bello
Developer
[Descrizione: cid:image001.jpg@01CEB308.188717E0]
Horsa S.p.A.
Via Cadorna, 67
Vimodrone (MI)
Mobile (+39) 347 37 64 875
www.horsa.it<http://www.horsa.it/>