diff --git a/adapters/oidc/js/src/main/resources/keycloak.js b/adapters/oidc/js/src/main/resources/keycloak.js
index f0cae4211c..2def1e2a8e 100755
--- a/adapters/oidc/js/src/main/resources/keycloak.js
+++ b/adapters/oidc/js/src/main/resources/keycloak.js
@@ -87,6 +87,10 @@
}
kc.flow = initOptions.flow;
}
+
+ if (initOptions.timeSkew != null) {
+ kc.timeSkew = initOptions.timeSkew;
+ }
}
if (!kc.responseMode) {
@@ -162,12 +166,8 @@
kc.onAuthSuccess && kc.onAuthSuccess();
initPromise.setSuccess();
}).error(function () {
- kc.onAuthError && kc.onAuthError();
- if (initOptions.onLoad) {
- onLoad();
- } else {
- initPromise.setError();
- }
+ setToken(null, null, null);
+ initPromise.setSuccess();
});
});
} else {
@@ -369,6 +369,11 @@
throw 'Not authenticated';
}
+ if (kc.timeSkew == null) {
+ console.info('[KEYCLOAK] Unable to determine if token is expired as timeskew is not set');
+ return true;
+ }
+
var expiresIn = kc.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + kc.timeSkew;
if (minValidity) {
expiresIn -= minValidity;
@@ -653,12 +658,7 @@
if (token) {
kc.token = token;
kc.tokenParsed = decodeToken(token);
-
- var sessionId = kc.realm + '/' + kc.tokenParsed.sub;
- if (kc.tokenParsed.session_state) {
- sessionId = sessionId + '/' + kc.tokenParsed.session_state;
- }
- kc.sessionId = sessionId;
+ kc.sessionId = kc.tokenParsed.session_state;
kc.authenticated = true;
kc.subject = kc.tokenParsed.sub;
kc.realmAccess = kc.tokenParsed.realm_access;
@@ -666,6 +666,9 @@
if (timeLocal) {
kc.timeSkew = Math.floor(timeLocal / 1000) - kc.tokenParsed.iat;
+ }
+
+ if (kc.timeSkew != null) {
console.info('[KEYCLOAK] Estimated time difference between browser and server is ' + kc.timeSkew + ' seconds');
if (kc.onTokenExpired) {
@@ -677,11 +680,7 @@
kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn);
}
}
- } else {
- kc.updateToken(-1);
}
- } else if (refreshToken) {
- kc.updateToken(-1);
} else {
delete kc.token;
delete kc.tokenParsed;
diff --git a/adapters/oidc/js/src/main/resources/login-status-iframe.html b/adapters/oidc/js/src/main/resources/login-status-iframe.html
index f941663e4f..b1012f7694 100755
--- a/adapters/oidc/js/src/main/resources/login-status-iframe.html
+++ b/adapters/oidc/js/src/main/resources/login-status-iframe.html
@@ -53,7 +53,8 @@
req.send();
} else {
if (clientId === init.clientId && origin === init.origin) {
- if (sessionState === cookie) {
+ var c = cookie.split('/');
+ if (sessionState === c[2]) {
callback('unchanged');
} else {
callback('changed');
@@ -81,7 +82,7 @@
var origin = event.origin;
var data = event.data.split(' ');
if (data.length != 2) {
- event.source.postMessage('error', origin);
+ return;
}
var clientId = data[0];
diff --git a/distribution/downloads/assembly.xml b/distribution/downloads/assembly.xml
new file mode 100644
index 0000000000..9d408d1448
--- /dev/null
+++ b/distribution/downloads/assembly.xml
@@ -0,0 +1,33 @@
+
+
+
+ server-dist
+
+
+ dir
+
+
+
+
+ ${localRepository}/org/keycloak
+
+ **/*.zip
+
+
+
+
diff --git a/distribution/downloads/pom.xml b/distribution/downloads/pom.xml
index a1f114e2d3..1a8a6fd3d4 100755
--- a/distribution/downloads/pom.xml
+++ b/distribution/downloads/pom.xml
@@ -25,16 +25,25 @@
keycloak-dist-downloads
- pom
+ jar
Keycloak Release Downloads
-
-
-
+
+ 1.8
+ 1.8
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${maven.compiler.target}
+
+
org.apache.maven.plugins
maven-deploy-plugin
@@ -43,342 +52,22 @@
- org.apache.maven.plugins
- maven-dependency-plugin
+ org.codehaus.mojo
+ exec-maven-plugin
server-downloads
- install
+ package
- copy
+ java
-
-
- org.keycloak
- keycloak-server-dist
- zip
- keycloak-${project.version}.zip
-
-
- org.keycloak
- keycloak-server-dist
- tar.gz
- keycloak-${project.version}.tar.gz
-
-
-
- org.keycloak
- keycloak-demo-dist
- zip
- keycloak-demo-${project.version}.zip
-
-
- org.keycloak
- keycloak-demo-dist
- tar.gz
- keycloak-demo-${project.version}.tar.gz
-
-
-
- org.keycloak
- keycloak-server-overlay
- zip
- keycloak-overlay-${project.version}.zip
-
-
- org.keycloak
- keycloak-server-overlay
- tar.gz
- keycloak-overlay-${project.version}.tar.gz
-
-
-
- org.keycloak
- keycloak-proxy-dist
- zip
- keycloak-proxy-${project.version}.zip
-
-
-
- org.keycloak
- keycloak-api-docs-dist
- zip
- keycloak-api-docs-${project.version}.zip
-
-
- org.keycloak
- keycloak-examples-dist
- zip
- keycloak-examples-${project.version}.zip
-
-
- target/${project.version}
-
-
-
-
- adapter-downloads
- install
-
- copy
-
-
-
-
- org.keycloak
- keycloak-as7-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-as7-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-eap6-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-eap6-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-jetty81-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-jetty81-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-jetty91-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-jetty91-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-jetty92-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-jetty92-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-jetty93-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-jetty93-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-js-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-js-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-tomcat6-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-tomcat6-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-tomcat7-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-tomcat7-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-tomcat8-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-tomcat8-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-wf8-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-wf8-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-wildfly-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-wildfly-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-fuse-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-fuse-adapter-dist
- tar.gz
-
-
- target/${project.version}/adapters/keycloak-oidc
-
-
-
- saml-adapter-downloads
- install
-
- copy
-
-
-
-
- org.keycloak
- keycloak-saml-as7-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-as7-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-eap6-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-eap6-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-jetty81-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-jetty81-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-jetty92-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-jetty92-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-jetty93-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-jetty93-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-tomcat6-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-tomcat6-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-tomcat7-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-tomcat7-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-tomcat8-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-tomcat8-adapter-dist
- tar.gz
-
-
-
- org.keycloak
- keycloak-saml-wildfly-adapter-dist
- zip
-
-
- org.keycloak
- keycloak-saml-wildfly-adapter-dist
- tar.gz
-
-
- target/${project.version}/adapters/saml
+ CopyDependencies
+
+ ${settings.localRepository}
+ ${project.build.directory}
+ ${project.version}
+
diff --git a/distribution/downloads/src/main/java/CopyDependencies.java b/distribution/downloads/src/main/java/CopyDependencies.java
new file mode 100644
index 0000000000..6ab527e57b
--- /dev/null
+++ b/distribution/downloads/src/main/java/CopyDependencies.java
@@ -0,0 +1,49 @@
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+
+/**
+ * Created by st on 06.02.17.
+ */
+public class CopyDependencies {
+
+ public static void main(String[] args) throws IOException {
+ String version = args[2];
+
+ Path repository = new File(args[0]).toPath().resolve("org").resolve("keycloak");
+ Path targetRoot = new File(args[1]).toPath().resolve(version);
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(CopyDependencies.class.getResourceAsStream("files")));
+
+ Path target = targetRoot;
+ for (String l = br.readLine(); l != null; l = br.readLine()) {
+
+ if (l.startsWith("./")) {
+ target = targetRoot.resolve(l.replace("./", "").replace('/', File.separatorChar));
+ if (!target.toFile().isDirectory()) {
+ target.toFile().mkdirs();
+ }
+ } else if (l.trim().length() > 0) {
+ String[] t = l.trim().split(":");
+
+ String artifactName = t[0];
+ String destName = t.length == 1 ? artifactName : t[1];
+
+ File artifactDir = repository.resolve(artifactName).resolve(version).toFile();
+
+ for (File f : artifactDir.listFiles((file, name) -> name.contains(".tar.gz") || name.contains(".zip"))) {
+ Files.copy(f.toPath(), target.resolve(f.getName().replace(artifactName, destName)), StandardCopyOption.REPLACE_EXISTING);
+ }
+
+ System.out.println(artifactName);
+ }
+ }
+
+ br.close();
+ }
+
+}
diff --git a/distribution/downloads/src/main/resources/files b/distribution/downloads/src/main/resources/files
new file mode 100644
index 0000000000..e88c8e99a7
--- /dev/null
+++ b/distribution/downloads/src/main/resources/files
@@ -0,0 +1,33 @@
+./
+ keycloak-server-dist:keycloak
+ keycloak-demo-dist:keycloak-demo
+ keycloak-server-overlay:keycloak-overlay
+ keycloak-proxy-dist:keycloak-proxy
+ keycloak-api-docs-dist:keycloak-api-docs
+ keycloak-examples-dist:keycloak-examples
+
+./adapters/keycloak-oidc
+ keycloak-as7-adapter-dist
+ keycloak-eap6-adapter-dist
+ keycloak-jetty81-adapter-dist
+ keycloak-jetty91-adapter-dist
+ keycloak-jetty92-adapter-dist
+ keycloak-jetty93-adapter-dist
+ keycloak-js-adapter-dist
+ keycloak-tomcat6-adapter-dist
+ keycloak-tomcat7-adapter-dist
+ keycloak-tomcat8-adapter-dist
+ keycloak-wf8-adapter-dist
+ keycloak-wildfly-adapter-dist
+ keycloak-fuse-adapter-dist
+
+./adapters/saml
+ keycloak-saml-as7-adapter-dist
+ keycloak-saml-eap6-adapter-dist
+ keycloak-saml-jetty81-adapter-dist
+ keycloak-saml-jetty92-adapter-dist
+ keycloak-saml-jetty93-adapter-dist
+ keycloak-saml-tomcat6-adapter-dist
+ keycloak-saml-tomcat7-adapter-dist
+ keycloak-saml-tomcat8-adapter-dist
+ keycloak-saml-wildfly-adapter-dist
\ No newline at end of file
diff --git a/distribution/feature-packs/adapter-feature-pack/pom.xml b/distribution/feature-packs/adapter-feature-pack/pom.xml
index 9334e4e2c1..dcda6ee479 100755
--- a/distribution/feature-packs/adapter-feature-pack/pom.xml
+++ b/distribution/feature-packs/adapter-feature-pack/pom.xml
@@ -55,6 +55,13 @@
org.keycloak
keycloak-undertow-adapter
+
+
+
+ org.keycloak
+ keycloak-authz-client
+
+
org.wildfly
wildfly-feature-pack
diff --git a/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-adapter-core/main/module.xml b/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-adapter-core/main/module.xml
index 673b5cd906..9603619bc0 100755
--- a/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-adapter-core/main/module.xml
+++ b/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-adapter-core/main/module.xml
@@ -34,6 +34,7 @@
+
diff --git a/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-authz-client/main/module.xml b/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-authz-client/main/module.xml
new file mode 100755
index 0000000000..67cc62c319
--- /dev/null
+++ b/distribution/feature-packs/adapter-feature-pack/src/main/resources/modules/system/add-ons/keycloak/org/keycloak/keycloak-authz-client/main/module.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli
similarity index 52%
rename from distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli
rename to distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli
index 0ed854e5ef..d11e2b9f25 100644
--- a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli
@@ -1,9 +1,5 @@
embed-host-controller --domain-config=domain.xml
-# Early versions of keycloak used "default" for the standalone profile name.
-# Yours maybe be something completely different.
-set standaloneProfile=auth-server-standalone
-
# Early versions of keycloak used "ha" for the clustered profile name.
# Yours maybe be something completely different.
set clusteredProfile=auth-server-clustered
@@ -12,125 +8,6 @@ set clusteredProfile=auth-server-clustered
set pathToJson=../domain/configuration/keycloak-server.json
-echo *** Begin Migration of /profile=$standaloneProfile ***
-echo
-
-# Migrate from 1.8.1 to 1.9.1
-if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:read-resource
- echo Adding local-cache=work to keycloak cache container...
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:add(indexing=NONE,start=LAZY)
- echo
-end-if
-# realmVersions cache deprecated in 2.1.0
-#if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource
-# echo Adding local-cache=realmVersions to keycloak cache container...
-# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY)
-# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/component=transaction/:write-attribute(name=mode,value=BATCH)
-# echo
-#end-if
-
-
-# Migrate from 1.9.1 to 1.9.2
-if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy)
- echo Adding eviction strategy to keycloak users cache container...
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU)
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000)
- echo
-end-if
-
-# Migrate from 1.9.2 to 1.9.8
-# NO CHANGES
-
-# Migrate from 1.9.8 to 2.0.0
-if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:read-resource
- echo Adding local-cache=authorization to keycloak cache container...
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:add(indexing=NONE,start=LAZY)
- echo
-end-if
-if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:read-attribute(name=strategy,include-defaults=false)
- echo Updating authorization cache container..
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU)
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=max-entries,value=100)
-end-if
-
-# Migrate from 2.0.0 to 2.1.0
-if (outcome == success) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource
- echo Removing deprecated cache 'realmVersions'
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:remove
- echo
-end-if
-
-# Migrate kecloak-server.json (deprecated in 2.2.0)
-if (result == []) of /profile=$standaloneProfile/subsystem=keycloak-server/:read-children-names(child-type=spi)
- echo Migrating keycloak-server.json to keycloak-server subsystem...
- /profile=$standaloneProfile/subsystem=keycloak-server/:migrate-json(file=$pathToJson)
- echo
-end-if
-
-# Find if we are using jpa or mongo
-if (result == mongo) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=realm/:read-attribute(name=default-provider)
- set persistenceProvider=mongo
-else
- set persistenceProvider=jpa
-end-if
-
-# Migrate from 2.1.0 to 2.2.0
-if (result == update) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema)
- echo Updating connectionsJpa default properties...
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema)
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true)
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update)
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationExport,value=${jboss.home.dir}/keycloak-database-update.sql)
- echo
-end-if
-if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource
- echo Adding spi=userFederatedStorage...
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider)
- echo
-end-if
-if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:read-resource
- echo Adding spi=jta-lookup...
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss})
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/provider=jboss/:add(enabled=true)
- echo
-end-if
-
-# Migrate from 2.2.0 to 2.2.1
-# NO CHANGES
-
-# Migrate from 2.2.1 to 2.3.0
-if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource
- echo Adding local-cache=keys to keycloak cache container...
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY)
- echo
-end-if
-if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:read-attribute(name=strategy,include-defaults=false)
- echo Updating eviction and expiration in local-cache=keys...
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU)
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000)
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=expiration/:write-attribute(name=max-idle,value=3600000)
- echo
-end-if
-if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:read-resource
- echo Adding spi=publicKeyStorage...
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:add
- /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/provider=infinispan/:add(properties={minTimeBetweenRequests => "10"},enabled=true)
- echo
-end-if
-
-# Migrate from 2.3.0 to 2.4.0
-# NO CHANGES
-
-# Migrate from 2.4.0 to 2.5.0
-if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy)
- echo Adding eviction strategy to keycloak realms cache...
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU)
- /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000)
- echo
-end-if
-
-echo *** End Migration of /profile=$standaloneProfile ***
-echo
echo
echo *** Begin Migration of /profile=$clusteredProfile ***
echo
@@ -260,4 +137,4 @@ if (result == NONE) of /profile=$clusteredProfile/subsystem=infinispan/cache-con
echo
end-if
-echo *** End Migration ***
\ No newline at end of file
+echo *** End Migration of /profile=$clusteredProfile ***
\ No newline at end of file
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli
new file mode 100644
index 0000000000..b24819e3b0
--- /dev/null
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli
@@ -0,0 +1,128 @@
+embed-host-controller --domain-config=domain.xml
+
+# Early versions of keycloak used "default" for the standalone profile name.
+# Yours maybe be something completely different.
+set standaloneProfile=auth-server-standalone
+
+# keycloak-server.json is not normally on this path.
+set pathToJson=../domain/configuration/keycloak-server.json
+
+
+echo *** Begin Migration of /profile=$standaloneProfile ***
+echo
+
+# Migrate from 1.8.1 to 1.9.1
+if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:read-resource
+ echo Adding local-cache=work to keycloak cache container...
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:add(indexing=NONE,start=LAZY)
+ echo
+end-if
+# realmVersions cache deprecated in 2.1.0
+#if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource
+# echo Adding local-cache=realmVersions to keycloak cache container...
+# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY)
+# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/component=transaction/:write-attribute(name=mode,value=BATCH)
+# echo
+#end-if
+
+
+# Migrate from 1.9.1 to 1.9.2
+if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy)
+ echo Adding eviction strategy to keycloak users cache container...
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU)
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000)
+ echo
+end-if
+
+# Migrate from 1.9.2 to 1.9.8
+# NO CHANGES
+
+# Migrate from 1.9.8 to 2.0.0
+if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:read-resource
+ echo Adding local-cache=authorization to keycloak cache container...
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:add(indexing=NONE,start=LAZY)
+ echo
+end-if
+if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:read-attribute(name=strategy,include-defaults=false)
+ echo Updating authorization cache container..
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU)
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=max-entries,value=100)
+end-if
+
+# Migrate from 2.0.0 to 2.1.0
+if (outcome == success) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource
+ echo Removing deprecated cache 'realmVersions'
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:remove
+ echo
+end-if
+
+# Migrate kecloak-server.json (deprecated in 2.2.0)
+if (result == []) of /profile=$standaloneProfile/subsystem=keycloak-server/:read-children-names(child-type=spi)
+ echo Migrating keycloak-server.json to keycloak-server subsystem...
+ /profile=$standaloneProfile/subsystem=keycloak-server/:migrate-json(file=$pathToJson)
+ echo
+end-if
+
+# Find if we are using jpa or mongo
+if (result == mongo) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=realm/:read-attribute(name=default-provider)
+ set persistenceProvider=mongo
+else
+ set persistenceProvider=jpa
+end-if
+
+# Migrate from 2.1.0 to 2.2.0
+if (result == update) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema)
+ echo Updating connectionsJpa default properties...
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema)
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true)
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update)
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationExport,value=${jboss.home.dir}/keycloak-database-update.sql)
+ echo
+end-if
+if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource
+ echo Adding spi=userFederatedStorage...
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider)
+ echo
+end-if
+if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:read-resource
+ echo Adding spi=jta-lookup...
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss})
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/provider=jboss/:add(enabled=true)
+ echo
+end-if
+
+# Migrate from 2.2.0 to 2.2.1
+# NO CHANGES
+
+# Migrate from 2.2.1 to 2.3.0
+if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource
+ echo Adding local-cache=keys to keycloak cache container...
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY)
+ echo
+end-if
+if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:read-attribute(name=strategy,include-defaults=false)
+ echo Updating eviction and expiration in local-cache=keys...
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU)
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000)
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=expiration/:write-attribute(name=max-idle,value=3600000)
+ echo
+end-if
+if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:read-resource
+ echo Adding spi=publicKeyStorage...
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:add
+ /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/provider=infinispan/:add(properties={minTimeBetweenRequests => "10"},enabled=true)
+ echo
+end-if
+
+# Migrate from 2.3.0 to 2.4.0
+# NO CHANGES
+
+# Migrate from 2.4.0 to 2.5.0
+if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy)
+ echo Adding eviction strategy to keycloak realms cache...
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU)
+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000)
+ echo
+end-if
+
+echo *** End Migration of /profile=$standaloneProfile ***
\ No newline at end of file
diff --git a/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java b/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java
index 249a3a0e78..3151a3b19f 100644
--- a/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java
+++ b/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java
@@ -124,6 +124,11 @@ public class LDAPIdentityStore implements IdentityStore {
String rdnAttrVal = ldapObject.getAttributeAsString(rdnAttrName);
+ // Could be the case when RDN attribute of the target object is not included in Keycloak mappers
+ if (rdnAttrVal == null) {
+ return;
+ }
+
String oldRdnAttrVal = ldapObject.getDn().getFirstRdnAttrValue();
if (!oldRdnAttrVal.equals(rdnAttrVal)) {
LDAPDn newLdapDn = ldapObject.getDn().getParentDn();
diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java
index bf3e92d33f..94cb5b1295 100644
--- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java
+++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java
@@ -40,7 +40,9 @@ public class MigrateUserFedToComponent extends AbstractUserFedToComponent {
protected void generateStatementsImpl() throws CustomChangeException {
List factories = kcSession.getKeycloakSessionFactory().getProviderFactories(UserStorageProvider.class);
for (ProviderFactory factory : factories) {
- convertFedProviderToComponent(factory.getId(), null);
+ if (!factory.getId().equals(LDAPConstants.LDAP_PROVIDER)) {
+ convertFedProviderToComponent(factory.getId(), null);
+ }
}
}
diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java
index dc9e6073c3..8d1e6795f4 100644
--- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java
+++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java
@@ -27,7 +27,6 @@ public class PortLdapUserFedToComponentModel extends AbstractUserFedToComponent
@Override
protected void generateStatementsImpl() throws CustomChangeException {
- String providerId = LDAPConstants.LDAP_PROVIDER;
convertFedProviderToComponent(LDAPConstants.LDAP_PROVIDER, "org.keycloak.storage.ldap.mappers.LDAPStorageMapper");
}
diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/api/util/KeyInfoTools.java b/saml-core/src/main/java/org/keycloak/saml/processing/api/util/KeyInfoTools.java
index be9bf51ddb..69fc05cae0 100644
--- a/saml-core/src/main/java/org/keycloak/saml/processing/api/util/KeyInfoTools.java
+++ b/saml-core/src/main/java/org/keycloak/saml/processing/api/util/KeyInfoTools.java
@@ -35,6 +35,9 @@ public class KeyInfoTools {
* @return The object or {@code null} if not found.
*/
public static T getContent(Iterable