Merge pull request #2389 from thomasdarimont/issue/KEYCLOAK-2686-migration-from-191-to-192
KEYCLOAK-2686 - Fix failing migration from 1.9.1 to 1.9.2.
This commit is contained in:
commit
3e208c10aa
1 changed files with 9 additions and 2 deletions
|
@ -18,10 +18,13 @@
|
|||
package org.keycloak.migration.migrators;
|
||||
|
||||
import org.keycloak.migration.ModelVersion;
|
||||
import org.keycloak.models.BrowserSecurityHeaders;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.RealmModel;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MigrateTo1_9_2 {
|
||||
|
||||
public static final ModelVersion VERSION = new ModelVersion("1.9.2");
|
||||
|
@ -29,7 +32,11 @@ public class MigrateTo1_9_2 {
|
|||
public void migrate(KeycloakSession session) {
|
||||
for (RealmModel realm : session.realms().getRealms()) {
|
||||
if (realm.getBrowserSecurityHeaders() != null) {
|
||||
realm.getBrowserSecurityHeaders().put("xFrameOptions", "nosniff");
|
||||
|
||||
Map<String, String> browserSecurityHeaders = new HashMap<>(realm.getBrowserSecurityHeaders());
|
||||
browserSecurityHeaders.put("xFrameOptions", "nosniff");
|
||||
|
||||
realm.setBrowserSecurityHeaders(Collections.unmodifiableMap(browserSecurityHeaders));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue