fix mongo

This commit is contained in:
Bill Burke 2015-03-02 08:55:11 -05:00
parent 4361ce1d42
commit 6f88d50d4d
5 changed files with 311 additions and 307 deletions

View file

@ -28,6 +28,8 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
"org.keycloak.models.mongo.keycloak.entities.MongoUserEntity",
"org.keycloak.models.mongo.keycloak.entities.MongoRoleEntity",
"org.keycloak.models.entities.IdentityProviderEntity",
"org.keycloak.models.entities.ClientIdentityProviderMappingEntity",
"org.keycloak.models.entities.ProtocolMapperEntity",
"org.keycloak.models.entities.RequiredCredentialEntity",
"org.keycloak.models.entities.CredentialEntity",
"org.keycloak.models.entities.FederatedIdentityEntity",

View file

@ -23,7 +23,7 @@ package org.keycloak.models.entities;
public class ClientIdentityProviderMappingEntity {
private String id;
private Boolean retrieveToken;
private boolean retrieveToken;
public String getId() {
return this.id;
@ -33,7 +33,7 @@ public class ClientIdentityProviderMappingEntity {
this.id = id;
}
public Boolean isRetrieveToken() {
public boolean isRetrieveToken() {
return this.retrieveToken;
}

View file

@ -327,15 +327,14 @@ public abstract class ClientAdapter<T extends MongoIdentifiableEntity> extends A
@Override
public void updateAllowedIdentityProviders(List<ClientIdentityProviderMappingModel> identityProviders) {
List<ClientIdentityProviderMappingEntity> stored = getMongoEntityAsClient().getIdentityProviders();
stored.clear();
for (ClientIdentityProviderMappingModel model : identityProviders) {
ClientIdentityProviderMappingEntity entity = new ClientIdentityProviderMappingEntity();
entity.setId(model.getIdentityProvider());
entity.setRetrieveToken(model.isRetrieveToken());
stored.add(entity);
}
getMongoEntityAsClient().setIdentityProviders(stored);
updateMongoEntity();
}

View file

@ -910,7 +910,7 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
mapping.setConsentRequired(entity.isConsentRequired());
mapping.setConsentText(entity.getConsentText());
Map<String, String> config = new HashMap<String, String>();
if (entity.getConfig() != null) config.putAll(config);
if (entity.getConfig() != null) config.putAll(entity.getConfig());
mapping.setConfig(config);
return mapping;
}

View file

@ -61,6 +61,7 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes
assertIdentityProviderConfig(realm.getIdentityProviders());
assertTrue(realm.isIdentityFederationEnabled());
this.realmManager.removeRealm(realm);
}
@Test
@ -113,6 +114,7 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes
assertTrue(identityProviderModel.isEnabled());
assertTrue(identityProviderModel.isUpdateProfileFirstLogin());
assertFalse(identityProviderModel.isAuthenticateByDefault());
this.realmManager.removeRealm(realm);
}
@Test
@ -137,6 +139,7 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes
identityProviders = client.getIdentityProviders();
assertEquals(0, identityProviders.size());
this.realmManager.removeRealm(realm);
}