diff --git a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml index c2f143ce60..e7b9ade368 100755 --- a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml +++ b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml @@ -28,7 +28,7 @@ - + diff --git a/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java b/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java index ed6844c3ed..dab99e081d 100755 --- a/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java +++ b/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java @@ -43,7 +43,10 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro "org.keycloak.models.entities.ProtocolMapperEntity", "org.keycloak.models.entities.IdentityProviderMapperEntity", "org.keycloak.models.mongo.keycloak.entities.MongoUserConsentEntity", - "org.keycloak.models.mongo.keycloak.entities.MongoMigrationModelEntity" + "org.keycloak.models.mongo.keycloak.entities.MongoMigrationModelEntity", + "org.keycloak.models.entities.AuthenticationExecutionEntity", + "org.keycloak.models.entities.AuthenticationFlowEntity", + "org.keycloak.models.entities.AuthenticatorEntity", }; private static final Logger logger = Logger.getLogger(DefaultMongoConnectionFactoryProvider.class); diff --git a/events/mongo/src/main/java/org/keycloak/events/mongo/MongoAdminEventQuery.java b/events/mongo/src/main/java/org/keycloak/events/mongo/MongoAdminEventQuery.java index 4fdb9221ed..612294e09e 100644 --- a/events/mongo/src/main/java/org/keycloak/events/mongo/MongoAdminEventQuery.java +++ b/events/mongo/src/main/java/org/keycloak/events/mongo/MongoAdminEventQuery.java @@ -76,13 +76,17 @@ public class MongoAdminEventQuery implements AdminEventQuery{ @Override public AdminEventQuery fromTime(Date fromTime) { - query.put("time", BasicDBObjectBuilder.start("$gte", fromTime.getTime()).get()); + BasicDBObject time = query.containsField("time") ? (BasicDBObject) query.get("time") : new BasicDBObject(); + time.append("$gte", fromTime.getTime()); + query.put("time", time); return this; } @Override public AdminEventQuery toTime(Date toTime) { - query.put("time", BasicDBObjectBuilder.start("$lte", toTime.getTime()).get()); + BasicDBObject time = query.containsField("time") ? (BasicDBObject) query.get("time") : new BasicDBObject(); + time.append("$lte", toTime.getTime()); + query.put("time", time); return this; } diff --git a/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java b/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java index f0e9dafc04..5c1bf6e76f 100755 --- a/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java +++ b/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java @@ -116,7 +116,7 @@ public class LDAPFederationProviderFactory extends UserFederationEventAwareProvi UserAttributeLDAPFederationMapper.READ_ONLY, readOnly); realm.addUserFederationMapper(mapperModel); - mapperModel = KeycloakModelUtils.createUserFederationMapperModel("username2", newProviderModel.getId(), UserAttributeLDAPFederationMapperFactory.PROVIDER_ID, + mapperModel = KeycloakModelUtils.createUserFederationMapperModel("username-cn", newProviderModel.getId(), UserAttributeLDAPFederationMapperFactory.PROVIDER_ID, UserAttributeLDAPFederationMapper.USER_MODEL_ATTRIBUTE, UserModel.USERNAME, UserAttributeLDAPFederationMapper.LDAP_ATTRIBUTE, LDAPConstants.CN, UserAttributeLDAPFederationMapper.READ_ONLY, readOnly); diff --git a/model/api/src/main/java/org/keycloak/models/entities/AuthenticationExecutionEntity.java b/model/api/src/main/java/org/keycloak/models/entities/AuthenticationExecutionEntity.java index c90a6575b0..e98b37188b 100755 --- a/model/api/src/main/java/org/keycloak/models/entities/AuthenticationExecutionEntity.java +++ b/model/api/src/main/java/org/keycloak/models/entities/AuthenticationExecutionEntity.java @@ -13,7 +13,7 @@ public class AuthenticationExecutionEntity { protected AuthenticationExecutionModel.Requirement requirement; protected int priority; private boolean userSetupAllowed; - private boolean autheticatorFlow; + private boolean authenticatorFlow; private String parentFlow; public String getId() { @@ -56,12 +56,12 @@ public class AuthenticationExecutionEntity { this.userSetupAllowed = userSetupAllowed; } - public boolean isAutheticatorFlow() { - return autheticatorFlow; + public boolean isAuthenticatorFlow() { + return authenticatorFlow; } - public void setAutheticatorFlow(boolean autheticatorFlow) { - this.autheticatorFlow = autheticatorFlow; + public void setAuthenticatorFlow(boolean authenticatorFlow) { + this.authenticatorFlow = authenticatorFlow; } public String getParentFlow() { diff --git a/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java b/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java index 68c2f3468d..1a19bad3d6 100755 --- a/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java +++ b/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java @@ -1287,7 +1287,7 @@ public class RealmAdapter implements RealmModel { model.setPriority(entity.getPriority()); model.setAuthenticator(entity.getAuthenticator()); model.setParentFlow(entity.getParentFlow()); - model.setAutheticatorFlow(entity.isAutheticatorFlow()); + model.setAutheticatorFlow(entity.isAuthenticatorFlow()); return model; } @@ -1317,7 +1317,7 @@ public class RealmAdapter implements RealmModel { entity.setPriority(model.getPriority()); entity.setRequirement(model.getRequirement()); entity.setUserSetupAllowed(model.isUserSetupAllowed()); - entity.setAutheticatorFlow(model.isAutheticatorFlow()); + entity.setAuthenticatorFlow(model.isAutheticatorFlow()); AuthenticationFlowEntity flow = getFlowEntity(model.getId()); flow.getExecutions().add(entity); model.setId(entity.getId()); @@ -1335,7 +1335,7 @@ public class RealmAdapter implements RealmModel { } } if (entity == null) return; - entity.setAutheticatorFlow(model.isAutheticatorFlow()); + entity.setAuthenticatorFlow(model.isAutheticatorFlow()); entity.setAuthenticator(model.getAuthenticator()); entity.setPriority(model.getPriority()); entity.setRequirement(model.getRequirement()); 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 1515001071..aa25be77b5 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 @@ -1236,7 +1236,6 @@ public class RealmAdapter extends AbstractMongoAdapter impleme @Override public List getAuthenticationFlows() { List flows = getMongoEntity().getAuthenticationFlows(); - if (flows.size() == 0) return Collections.EMPTY_LIST; List models = new LinkedList<>(); for (AuthenticationFlowEntity entity : flows) { AuthenticationFlowModel model = entityToModel(entity); @@ -1255,10 +1254,9 @@ public class RealmAdapter extends AbstractMongoAdapter impleme @Override public AuthenticationFlowModel getAuthenticationFlowById(String id) { - for (AuthenticationFlowModel model : getAuthenticationFlows()) { - if (model.getId().equals(id)) return model; - } - return null; + AuthenticationFlowEntity entity = getFlowEntity(id); + if (entity == null) return null; + return entityToModel(entity); } protected AuthenticationFlowEntity getFlowEntity(String id) { @@ -1280,7 +1278,6 @@ public class RealmAdapter extends AbstractMongoAdapter impleme @Override public void updateAuthenticationFlow(AuthenticationFlowModel model) { - List flows = getMongoEntity().getAuthenticationFlows(); AuthenticationFlowEntity toUpdate = getFlowEntity(model.getId());; if (toUpdate == null) return; toUpdate.setAlias(model.getAlias()); @@ -1322,7 +1319,7 @@ public class RealmAdapter extends AbstractMongoAdapter impleme model.setPriority(entity.getPriority()); model.setAuthenticator(entity.getAuthenticator()); model.setParentFlow(entity.getParentFlow()); - model.setAutheticatorFlow(entity.isAutheticatorFlow()); + model.setAutheticatorFlow(entity.isAuthenticatorFlow()); return model; } @@ -1352,8 +1349,9 @@ public class RealmAdapter extends AbstractMongoAdapter impleme entity.setPriority(model.getPriority()); entity.setRequirement(model.getRequirement()); entity.setUserSetupAllowed(model.isUserSetupAllowed()); - entity.setAutheticatorFlow(model.isAutheticatorFlow()); - AuthenticationFlowEntity flow = getFlowEntity(model.getId()); + entity.setAuthenticatorFlow(model.isAutheticatorFlow()); + entity.setParentFlow(model.getParentFlow()); + AuthenticationFlowEntity flow = getFlowEntity(model.getParentFlow()); flow.getExecutions().add(entity); updateMongoEntity(); model.setId(entity.getId()); @@ -1371,7 +1369,7 @@ public class RealmAdapter extends AbstractMongoAdapter impleme } } if (entity == null) return; - entity.setAutheticatorFlow(model.isAutheticatorFlow()); + entity.setAuthenticatorFlow(model.isAutheticatorFlow()); entity.setAuthenticator(model.getAuthenticator()); entity.setPriority(model.getPriority()); entity.setRequirement(model.getRequirement());