Minor model fix
This commit is contained in:
parent
e1188e0c68
commit
82e290e06c
4 changed files with 31 additions and 9 deletions
|
@ -108,6 +108,15 @@ public class ModelToRepresentation {
|
||||||
rep.setQuickLoginCheckMilliSeconds(realm.getQuickLoginCheckMilliSeconds());
|
rep.setQuickLoginCheckMilliSeconds(realm.getQuickLoginCheckMilliSeconds());
|
||||||
rep.setMaxDeltaTimeSeconds(realm.getMaxDeltaTimeSeconds());
|
rep.setMaxDeltaTimeSeconds(realm.getMaxDeltaTimeSeconds());
|
||||||
rep.setFailureFactor(realm.getFailureFactor());
|
rep.setFailureFactor(realm.getFailureFactor());
|
||||||
|
|
||||||
|
rep.setEventsEnabled(realm.isEventsEnabled());
|
||||||
|
if (realm.getEventsExpiration() != 0) {
|
||||||
|
rep.setEventsExpiration(realm.getEventsExpiration());
|
||||||
|
}
|
||||||
|
if (realm.getEventsListeners() != null) {
|
||||||
|
rep.setEventsListeners(new LinkedList<String>(realm.getEventsListeners()));
|
||||||
|
}
|
||||||
|
|
||||||
rep.setVerifyEmail(realm.isVerifyEmail());
|
rep.setVerifyEmail(realm.isVerifyEmail());
|
||||||
rep.setResetPasswordAllowed(realm.isResetPasswordAllowed());
|
rep.setResetPasswordAllowed(realm.isResetPasswordAllowed());
|
||||||
rep.setAccessTokenLifespan(realm.getAccessTokenLifespan());
|
rep.setAccessTokenLifespan(realm.getAccessTokenLifespan());
|
||||||
|
|
|
@ -1104,9 +1104,9 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
@Override
|
@Override
|
||||||
public void setSupportedLocales(Set<String> locales) {
|
public void setSupportedLocales(Set<String> locales) {
|
||||||
if (locales != null) {
|
if (locales != null) {
|
||||||
realm.setEventsListeners(new ArrayList<String>(locales));
|
realm.setSupportedLocales(new ArrayList<String>(locales));
|
||||||
} else {
|
} else {
|
||||||
realm.setEventsListeners(Collections.EMPTY_LIST);
|
realm.setSupportedLocales(Collections.EMPTY_LIST);
|
||||||
}
|
}
|
||||||
updateRealm();
|
updateRealm();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class ApplianceBootstrap {
|
||||||
realm.setSsoSessionMaxLifespan(36000);
|
realm.setSsoSessionMaxLifespan(36000);
|
||||||
realm.setAccessCodeLifespan(60);
|
realm.setAccessCodeLifespan(60);
|
||||||
realm.setAccessCodeLifespanUserAction(300);
|
realm.setAccessCodeLifespanUserAction(300);
|
||||||
|
realm.setAccessCodeLifespanLogin(1800);
|
||||||
realm.setSslRequired(SslRequired.EXTERNAL);
|
realm.setSslRequired(SslRequired.EXTERNAL);
|
||||||
realm.setRegistrationAllowed(false);
|
realm.setRegistrationAllowed(false);
|
||||||
realm.setRegistrationEmailAsUsername(false);
|
realm.setRegistrationEmailAsUsername(false);
|
||||||
|
|
|
@ -9,7 +9,9 @@ import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.ModelToRepresentation;
|
import org.keycloak.models.utils.ModelToRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class ModelTest extends AbstractModelTest {
|
public class ModelTest extends AbstractModelTest {
|
||||||
|
|
||||||
|
@ -33,11 +35,14 @@ public class ModelTest extends AbstractModelTest {
|
||||||
smtp.put("hostname", "localhost");
|
smtp.put("hostname", "localhost");
|
||||||
realm.setSmtpConfig(smtp);
|
realm.setSmtpConfig(smtp);
|
||||||
|
|
||||||
HashMap<String, String> social = new HashMap<String,String>();
|
realm.setDefaultLocale("en");
|
||||||
social.put("google.key", "1234");
|
realm.setAccessCodeLifespanLogin(100);
|
||||||
social.put("google.secret", "5678");
|
realm.setInternationalizationEnabled(true);
|
||||||
//FIXME: KEYCLOAK-883
|
realm.setRegistrationEmailAsUsername(true);
|
||||||
// realm.setSocialConfig(social);
|
realm.setSupportedLocales(new HashSet<String>(Arrays.asList("en", "cz")));
|
||||||
|
realm.setEventsListeners(new HashSet<String>(Arrays.asList("jpa", "mongo", "foo")));
|
||||||
|
realm.setEventsExpiration(200);
|
||||||
|
realm.setEventsEnabled(true);
|
||||||
|
|
||||||
RealmModel persisted = realmManager.getRealm(realm.getId());
|
RealmModel persisted = realmManager.getRealm(realm.getId());
|
||||||
assertEquals(realm, persisted);
|
assertEquals(realm, persisted);
|
||||||
|
@ -62,8 +67,15 @@ public class ModelTest extends AbstractModelTest {
|
||||||
Assert.assertEquals(expected.getDefaultRoles(), actual.getDefaultRoles());
|
Assert.assertEquals(expected.getDefaultRoles(), actual.getDefaultRoles());
|
||||||
|
|
||||||
Assert.assertEquals(expected.getSmtpConfig(), actual.getSmtpConfig());
|
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) {
|
private RealmModel importExport(RealmModel src, String copyName) {
|
||||||
|
|
Loading…
Reference in a new issue