diff --git a/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java b/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java index 736aff8b12..5574bc17e2 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java +++ b/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java @@ -108,6 +108,15 @@ public class ModelToRepresentation { rep.setQuickLoginCheckMilliSeconds(realm.getQuickLoginCheckMilliSeconds()); rep.setMaxDeltaTimeSeconds(realm.getMaxDeltaTimeSeconds()); rep.setFailureFactor(realm.getFailureFactor()); + + rep.setEventsEnabled(realm.isEventsEnabled()); + if (realm.getEventsExpiration() != 0) { + rep.setEventsExpiration(realm.getEventsExpiration()); + } + if (realm.getEventsListeners() != null) { + rep.setEventsListeners(new LinkedList(realm.getEventsListeners())); + } + rep.setVerifyEmail(realm.isVerifyEmail()); rep.setResetPasswordAllowed(realm.isResetPasswordAllowed()); rep.setAccessTokenLifespan(realm.getAccessTokenLifespan()); diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java index 655a45293c..bf0ea87578 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java @@ -1104,9 +1104,9 @@ public class RealmAdapter extends AbstractMongoAdapter impleme @Override public void setSupportedLocales(Set locales) { if (locales != null) { - realm.setEventsListeners(new ArrayList(locales)); + realm.setSupportedLocales(new ArrayList(locales)); } else { - realm.setEventsListeners(Collections.EMPTY_LIST); + realm.setSupportedLocales(Collections.EMPTY_LIST); } updateRealm(); } diff --git a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java index 252a081df4..96d97e34f0 100755 --- a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java +++ b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java @@ -54,6 +54,7 @@ public class ApplianceBootstrap { realm.setSsoSessionMaxLifespan(36000); realm.setAccessCodeLifespan(60); realm.setAccessCodeLifespanUserAction(300); + realm.setAccessCodeLifespanLogin(1800); realm.setSslRequired(SslRequired.EXTERNAL); realm.setRegistrationAllowed(false); realm.setRegistrationEmailAsUsername(false); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ModelTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ModelTest.java index b427a1644c..9a4fb5f113 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ModelTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ModelTest.java @@ -9,7 +9,9 @@ import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.representations.idm.RealmRepresentation; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; public class ModelTest extends AbstractModelTest { @@ -33,11 +35,14 @@ public class ModelTest extends AbstractModelTest { smtp.put("hostname", "localhost"); realm.setSmtpConfig(smtp); - HashMap social = new HashMap(); - social.put("google.key", "1234"); - social.put("google.secret", "5678"); - //FIXME: KEYCLOAK-883 -// realm.setSocialConfig(social); + realm.setDefaultLocale("en"); + realm.setAccessCodeLifespanLogin(100); + realm.setInternationalizationEnabled(true); + realm.setRegistrationEmailAsUsername(true); + realm.setSupportedLocales(new HashSet(Arrays.asList("en", "cz"))); + realm.setEventsListeners(new HashSet(Arrays.asList("jpa", "mongo", "foo"))); + realm.setEventsExpiration(200); + realm.setEventsEnabled(true); RealmModel persisted = realmManager.getRealm(realm.getId()); assertEquals(realm, persisted); @@ -62,8 +67,15 @@ public class ModelTest extends AbstractModelTest { Assert.assertEquals(expected.getDefaultRoles(), actual.getDefaultRoles()); Assert.assertEquals(expected.getSmtpConfig(), actual.getSmtpConfig()); - //FIXME: KEYCLOAK-883 -// Assert.assertEquals(expected.getSocialConfig(), actual.getSocialConfig()); + + Assert.assertEquals(expected.getDefaultLocale(), actual.getDefaultLocale()); + Assert.assertEquals(expected.getAccessCodeLifespanLogin(), actual.getAccessCodeLifespanLogin()); + Assert.assertEquals(expected.isInternationalizationEnabled(), actual.isInternationalizationEnabled()); + Assert.assertEquals(expected.isRegistrationEmailAsUsername(), actual.isRegistrationEmailAsUsername()); + Assert.assertEquals(expected.getSupportedLocales(), actual.getSupportedLocales()); + Assert.assertEquals(expected.getEventsListeners(), actual.getEventsListeners()); + Assert.assertEquals(expected.getEventsExpiration(), actual.getEventsExpiration()); + Assert.assertEquals(expected.isEventsEnabled(), actual.isEventsEnabled()); } private RealmModel importExport(RealmModel src, String copyName) {