commit
8d627f1329
5 changed files with 75 additions and 41 deletions
|
@ -102,6 +102,27 @@
|
||||||
to newer version and upgrade few methods, which has changed signature. Changes are really minor, but were needed to improve performance of federation.
|
to newer version and upgrade few methods, which has changed signature. Changes are really minor, but were needed to improve performance of federation.
|
||||||
</para>
|
</para>
|
||||||
</simplesect>
|
</simplesect>
|
||||||
|
<simplesect>
|
||||||
|
<title>WildFly 9.0.0.CR2</title>
|
||||||
|
<para>
|
||||||
|
Following on from the distribution changes that was done in the last release the standalone download
|
||||||
|
of Keycloak is now based on WildFly 9.0.0.CR2. This als affects the overlay which can only be deployed
|
||||||
|
to WildFly 9.0.0.CR2 or JBoss EAP 6.4.0.GA. WildFly 8.2.0.Final is no longer supported for the server.
|
||||||
|
</para>
|
||||||
|
</simplesect>
|
||||||
|
<simplesect>
|
||||||
|
<title>WildFly, JBoss EAP and JBoss AS7 adapters</title>
|
||||||
|
<para>
|
||||||
|
There are now 3 separate adapter downloads for WildFly, JBoss EAP and JBoss AS7:
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem><literal>eap6</literal> - for JBoss EAP 6.x</listitem>
|
||||||
|
<listitem><literal>wf9</literal> - for WildFly 9.x</listitem>
|
||||||
|
<listitem><literal>wf8</literal> - for WildFly 8.x</listitem>
|
||||||
|
<listitem><literal>as7</literal> - for JBoss AS 7.x</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
Make sure you grab the correct one.
|
||||||
|
</para>
|
||||||
|
</simplesect>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<title>Migrating from 1.2.0.Beta1 to 1.2.0.RC1</title>
|
<title>Migrating from 1.2.0.Beta1 to 1.2.0.RC1</title>
|
||||||
|
|
|
@ -14,10 +14,17 @@
|
||||||
the Keycloak download site. They are also available as a maven artifact.
|
the Keycloak download site. They are also available as a maven artifact.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Install on Wildfly:
|
Install on Wildfly 9:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
$ cd $WILDFLY_HOME
|
$ cd $WILDFLY_HOME
|
||||||
$ unzip keycloak-wildfly-adapter-dist.zip
|
$ unzip keycloak-wf9-adapter-dist.zip
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Install on Wildfly 8:
|
||||||
|
<programlisting>
|
||||||
|
$ cd $WILDFLY_HOME
|
||||||
|
$ unzip keycloak-wf8-adapter-dist.zip
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
@ -56,7 +63,6 @@ $ unzip keycloak-as7-adapter-dist.zip
|
||||||
</profile>
|
</profile>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<note>For AS7, the extension module is org.keycloak.keycloak-as7-subsystem.</note>
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Finally, you must specify a shared keycloak security domain.
|
Finally, you must specify a shared keycloak security domain.
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
|
|
||||||
|
|
||||||
<section id="overlay_install">
|
<section id="overlay_install">
|
||||||
<title>Install on existing WildFly 8.2.0.Final</title>
|
<title>Install on existing WildFly 9.0.0.CR2</title>
|
||||||
<para>
|
<para>
|
||||||
Keycloak can be installed into an existing WildFly 8.2.0.Final server. To do this download
|
Keycloak can be installed into an existing WildFly 9.0.0.CR2 server. To do this download
|
||||||
<literal>keycloak-overlay-&project.version;.zip</literal> or <literal>keycloak-overlay-&project.version;.tar.gz</literal>.
|
<literal>keycloak-overlay-&project.version;.zip</literal> or <literal>keycloak-overlay-&project.version;.tar.gz</literal>.
|
||||||
Once downloaded extract into the root directory of your WildFly installation. To start WildFly with Keycloak
|
Once downloaded extract into the root directory of your WildFly installation. To start WildFly with Keycloak
|
||||||
run:
|
run:
|
||||||
|
@ -72,32 +72,9 @@
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<title>Install on existing EAP 6.4.0.GA</title>
|
<title>Install on existing JBoss EAP 6.4.0.GA</title>
|
||||||
<para>
|
<para>
|
||||||
Keycloak can be installed into an existing EAP 6.4.0.GA server. To do this download
|
Same procedure as JBoss EAP 6.4.0.GA, but download <literal>keycloak-overlay-eap6-&project.version;.zip</literal> or <literal>keycloak-overlay-eap6-&project.version;.tar.gz</literal>.
|
||||||
<literal>keycloak-overlay-&project.version;.zip</literal> or <literal>keycloak-overlay-&project.version;.tar.gz</literal>.
|
|
||||||
Once downloaded extract into the root directory of your EAP installation.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
To add Keycloak to the a EAP sever configurations (standalone.xml, standalone-ha.xml, etc.) open
|
|
||||||
<literal>standalone/configuration/standalone-keycloak.xml</literal> and the configuration you want to add it
|
|
||||||
to, for example <literal>standalone/configuration/standalone.xml</literal>. From <literal>standalone-keycloak.xml</literal>
|
|
||||||
you need to copy 3 elements:
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem><literal><extension module="org.keycloak.keycloak-subsystem"/></literal></listitem>
|
|
||||||
<listitem><literal><datasource jndi-name="java:jboss/datasources/KeycloakDS" ...></literal></listitem>
|
|
||||||
<listitem><literal><subsystem xmlns="urn:jboss:domain:keycloak:1.0" ...></literal></listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
<note>
|
|
||||||
<literal>standalone-keycloak.xml</literal> is aimed at WildFly and won't work with EAP so you need to
|
|
||||||
copy the required configuration
|
|
||||||
</note>
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Once the server is started log into the admin console at
|
|
||||||
<ulink url="http://localhost:8080/auth/admin/index.html">http://localhost:8080/auth/admin/index.html</ulink>
|
|
||||||
(username: <emphasis>admin</emphasis> and password: <emphasis>admin</emphasis>). Keycloak will then prompt you to
|
|
||||||
enter in a new password.
|
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
|
@ -107,7 +84,7 @@
|
||||||
To install it first download <literal>keycloak-demo-&project.version;.zip</literal> or
|
To install it first download <literal>keycloak-demo-&project.version;.zip</literal> or
|
||||||
<literal>keycloak-demo-&project.version;.tar.gz</literal>. Once downloaded extract it inside
|
<literal>keycloak-demo-&project.version;.tar.gz</literal>. Once downloaded extract it inside
|
||||||
<literal>keycloak-demo-&project.version;</literal> you'll find <literal>keycloak</literal> which contains
|
<literal>keycloak-demo-&project.version;</literal> you'll find <literal>keycloak</literal> which contains
|
||||||
a full WildFly 8.2.0.Final server with Keycloak Server and Adapters included. You'll also find <literal>docs</literal>
|
a full WildFly 9.0.0.CR2 server with Keycloak Server and Adapters included. You'll also find <literal>docs</literal>
|
||||||
and <literal>examples</literal> which contains everything you need to get started developing applications that use Keycloak.
|
and <literal>examples</literal> which contains everything you need to get started developing applications that use Keycloak.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -31,9 +31,9 @@ public class DefaultCacheUserProvider implements CacheUserProvider {
|
||||||
protected boolean transactionActive;
|
protected boolean transactionActive;
|
||||||
protected boolean setRollbackOnly;
|
protected boolean setRollbackOnly;
|
||||||
|
|
||||||
protected Map<String, String> userInvalidations = new HashMap<String, String>();
|
protected Map<String, String> userInvalidations = new HashMap<>();
|
||||||
protected Set<String> realmInvalidations = new HashSet<String>();
|
protected Set<String> realmInvalidations = new HashSet<>();
|
||||||
protected Map<String, UserModel> managedUsers = new HashMap<String, UserModel>();
|
protected Map<String, UserModel> managedUsers = new HashMap<>();
|
||||||
|
|
||||||
protected boolean clearAll;
|
protected boolean clearAll;
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ public class DefaultCacheUserProvider implements CacheUserProvider {
|
||||||
if (cached == null) {
|
if (cached == null) {
|
||||||
UserModel model = getDelegate().getUserById(id, realm);
|
UserModel model = getDelegate().getUserById(id, realm);
|
||||||
if (model == null) return null;
|
if (model == null) return null;
|
||||||
|
if (managedUsers.containsKey(id)) return managedUsers.get(id);
|
||||||
if (userInvalidations.containsKey(id)) return model;
|
if (userInvalidations.containsKey(id)) return model;
|
||||||
cached = new CachedUser(realm, model);
|
cached = new CachedUser(realm, model);
|
||||||
cache.addCachedUser(realm.getId(), cached);
|
cache.addCachedUser(realm.getId(), cached);
|
||||||
|
@ -155,6 +156,7 @@ public class DefaultCacheUserProvider implements CacheUserProvider {
|
||||||
if (cached == null) {
|
if (cached == null) {
|
||||||
UserModel model = getDelegate().getUserByUsername(username, realm);
|
UserModel model = getDelegate().getUserByUsername(username, realm);
|
||||||
if (model == null) return null;
|
if (model == null) return null;
|
||||||
|
if (managedUsers.containsKey(model.getId())) return managedUsers.get(model.getId());
|
||||||
if (userInvalidations.containsKey(model.getId())) return model;
|
if (userInvalidations.containsKey(model.getId())) return model;
|
||||||
cached = new CachedUser(realm, model);
|
cached = new CachedUser(realm, model);
|
||||||
cache.addCachedUser(realm.getId(), cached);
|
cache.addCachedUser(realm.getId(), cached);
|
||||||
|
@ -181,6 +183,7 @@ public class DefaultCacheUserProvider implements CacheUserProvider {
|
||||||
if (cached == null) {
|
if (cached == null) {
|
||||||
UserModel model = getDelegate().getUserByEmail(email, realm);
|
UserModel model = getDelegate().getUserByEmail(email, realm);
|
||||||
if (model == null) return null;
|
if (model == null) return null;
|
||||||
|
if (managedUsers.containsKey(model.getId())) return managedUsers.get(model.getId());
|
||||||
if (userInvalidations.containsKey(model.getId())) return model;
|
if (userInvalidations.containsKey(model.getId())) return model;
|
||||||
cached = new CachedUser(realm, model);
|
cached = new CachedUser(realm, model);
|
||||||
cache.addCachedUser(realm.getId(), cached);
|
cache.addCachedUser(realm.getId(), cached);
|
||||||
|
@ -251,12 +254,16 @@ public class DefaultCacheUserProvider implements CacheUserProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles) {
|
public UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles) {
|
||||||
return getDelegate().addUser(realm, id, username, addDefaultRoles);
|
UserModel user = getDelegate().addUser(realm, id, username, addDefaultRoles);
|
||||||
|
managedUsers.put(user.getId(), user);
|
||||||
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserModel addUser(RealmModel realm, String username) {
|
public UserModel addUser(RealmModel realm, String username) {
|
||||||
return getDelegate().addUser(realm, username);
|
UserModel user = getDelegate().addUser(realm, username);
|
||||||
|
managedUsers.put(user.getId(), user);
|
||||||
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.*;
|
||||||
import org.keycloak.models.KeycloakSession;
|
|
||||||
import org.keycloak.models.RealmModel;
|
|
||||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
|
@ -26,7 +26,7 @@ public class CacheTest {
|
||||||
KeycloakSession session = kc.startSession();
|
KeycloakSession session = kc.startSession();
|
||||||
RealmModel realm = session.realms().getRealmByName("test");
|
RealmModel realm = session.realms().getRealmByName("test");
|
||||||
ClientModel testApp = realm.getClientByClientId("test-app");
|
ClientModel testApp = realm.getClientByClientId("test-app");
|
||||||
Assert.assertNotNull(testApp);
|
assertNotNull(testApp);
|
||||||
appId = testApp.getId();
|
appId = testApp.getId();
|
||||||
Assert.assertTrue(testApp.isEnabled());
|
Assert.assertTrue(testApp.isEnabled());
|
||||||
kc.stopSession(session, true);
|
kc.stopSession(session, true);
|
||||||
|
@ -48,7 +48,7 @@ public class CacheTest {
|
||||||
Assert.assertTrue(realm instanceof org.keycloak.models.cache.RealmAdapter);
|
Assert.assertTrue(realm instanceof org.keycloak.models.cache.RealmAdapter);
|
||||||
realm.setAccessCodeLifespanLogin(200);
|
realm.setAccessCodeLifespanLogin(200);
|
||||||
ClientModel testApp = realm.getClientByClientId("test-app");
|
ClientModel testApp = realm.getClientByClientId("test-app");
|
||||||
Assert.assertNotNull(testApp);
|
assertNotNull(testApp);
|
||||||
testApp.setEnabled(false);
|
testApp.setEnabled(false);
|
||||||
kc.stopSession(session, true);
|
kc.stopSession(session, true);
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,27 @@ public class CacheTest {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddUserNotAddedToCache() {
|
||||||
|
KeycloakSession session = kc.startSession();
|
||||||
|
try {
|
||||||
|
RealmModel realm = session.realms().getRealmByName("test");
|
||||||
|
|
||||||
|
UserModel user = session.users().addUser(realm, "testAddUserNotAddedToCache");
|
||||||
|
user.setFirstName("firstName");
|
||||||
|
user.addRequiredAction(UserModel.RequiredAction.CONFIGURE_TOTP);
|
||||||
|
|
||||||
|
UserSessionModel userSession = session.sessions().createUserSession(realm, user, "testAddUserNotAddedToCache", "127.0.0.1", "auth", false, null, null);
|
||||||
|
UserModel user2 = userSession.getUser();
|
||||||
|
|
||||||
|
user.setLastName("lastName");
|
||||||
|
|
||||||
|
assertNotNull(user2.getLastName());
|
||||||
|
} finally {
|
||||||
|
session.getTransaction().commit();
|
||||||
|
session.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue