commit
747c0f9869
6 changed files with 6 additions and 18 deletions
|
@ -44,7 +44,7 @@ public abstract class Update {
|
||||||
o.append(f, 1);
|
o.append(f, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
col.ensureIndex(o, new BasicDBObject("unique", unique).append("sparse", sparse));
|
col.createIndex(o, new BasicDBObject("unique", unique).append("sparse", sparse));
|
||||||
log.debugv("Created index {0}, fields={1}, unique={2}, sparse={3}", name, Arrays.toString(fields), unique, sparse);
|
log.debugv("Created index {0}, fields={1}, unique={2}, sparse={3}", name, Arrays.toString(fields), unique, sparse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class Update1_0_0_Final extends Update {
|
||||||
@Override
|
@Override
|
||||||
public void update(KeycloakSession session) throws ClassNotFoundException {
|
public void update(KeycloakSession session) throws ClassNotFoundException {
|
||||||
DBCollection realmsCollection = db.getCollection("realms");
|
DBCollection realmsCollection = db.getCollection("realms");
|
||||||
realmsCollection.ensureIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true));
|
realmsCollection.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true));
|
||||||
|
|
||||||
DefaultMongoUpdaterProvider.log.debugv("Created collection {0}", "realms");
|
DefaultMongoUpdaterProvider.log.debugv("Created collection {0}", "realms");
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,6 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
|
||||||
operationalInfo.put("mongoHosts", hosts);
|
operationalInfo.put("mongoHosts", hosts);
|
||||||
operationalInfo.put("mongoDatabaseName", dbName);
|
operationalInfo.put("mongoDatabaseName", dbName);
|
||||||
operationalInfo.put("mongoUser", uri.getUsername());
|
operationalInfo.put("mongoUser", uri.getUsername());
|
||||||
operationalInfo.put("mongoDriverVersion", client.getVersion());
|
|
||||||
|
|
||||||
logger.debugv("Initialized mongo model. host(s): %s, db: %s", uri.getHosts(), dbName);
|
logger.debugv("Initialized mongo model. host(s): %s, db: %s", uri.getHosts(), dbName);
|
||||||
return client;
|
return client;
|
||||||
|
@ -198,7 +197,6 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
|
||||||
operationalInfo.put("mongoServerAddress", client.getAddress().toString());
|
operationalInfo.put("mongoServerAddress", client.getAddress().toString());
|
||||||
operationalInfo.put("mongoDatabaseName", dbName);
|
operationalInfo.put("mongoDatabaseName", dbName);
|
||||||
operationalInfo.put("mongoUser", user);
|
operationalInfo.put("mongoUser", user);
|
||||||
operationalInfo.put("mongoDriverVersion", client.getVersion());
|
|
||||||
|
|
||||||
logger.debugv("Initialized mongo model. host: %s, port: %d, db: %s", host, port, dbName);
|
logger.debugv("Initialized mongo model. host: %s, port: %d, db: %s", host, port, dbName);
|
||||||
return client;
|
return client;
|
||||||
|
@ -214,9 +212,6 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
|
||||||
checkIntOption("socketTimeout", builder);
|
checkIntOption("socketTimeout", builder);
|
||||||
checkBooleanOption("socketKeepAlive", builder);
|
checkBooleanOption("socketKeepAlive", builder);
|
||||||
checkBooleanOption("autoConnectRetry", builder);
|
checkBooleanOption("autoConnectRetry", builder);
|
||||||
if (config.getLong("maxAutoConnectRetryTime") != null) {
|
|
||||||
builder.maxAutoConnectRetryTime(config.getLong("maxAutoConnectRetryTime"));
|
|
||||||
}
|
|
||||||
if(config.getBoolean("ssl", false)) {
|
if(config.getBoolean("ssl", false)) {
|
||||||
builder.socketFactory(SSLSocketFactory.getDefault());
|
builder.socketFactory(SSLSocketFactory.getDefault());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
package org.keycloak.connections.mongo.impl;
|
package org.keycloak.connections.mongo.impl;
|
||||||
|
|
||||||
import com.mongodb.BasicDBList;
|
import com.mongodb.*;
|
||||||
import com.mongodb.BasicDBObject;
|
|
||||||
import com.mongodb.DB;
|
|
||||||
import com.mongodb.DBCollection;
|
|
||||||
import com.mongodb.DBCursor;
|
|
||||||
import com.mongodb.DBObject;
|
|
||||||
import com.mongodb.MongoException;
|
|
||||||
import com.mongodb.WriteResult;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.connections.mongo.api.MongoCollection;
|
import org.keycloak.connections.mongo.api.MongoCollection;
|
||||||
import org.keycloak.connections.mongo.api.MongoEntity;
|
import org.keycloak.connections.mongo.api.MongoEntity;
|
||||||
|
@ -133,7 +126,7 @@ public class MongoStoreImpl implements MongoStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModelException convertException(MongoException e) {
|
public static ModelException convertException(MongoException e) {
|
||||||
if (e instanceof MongoException.DuplicateKey) {
|
if (e instanceof DuplicateKeyException) {
|
||||||
return new ModelDuplicateException(e);
|
return new ModelDuplicateException(e);
|
||||||
} else {
|
} else {
|
||||||
return new ModelException(e);
|
return new ModelException(e);
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -35,7 +35,7 @@
|
||||||
<keycloak.apache.httpcomponents.version>4.2.1</keycloak.apache.httpcomponents.version>
|
<keycloak.apache.httpcomponents.version>4.2.1</keycloak.apache.httpcomponents.version>
|
||||||
<undertow.version>1.1.1.Final</undertow.version>
|
<undertow.version>1.1.1.Final</undertow.version>
|
||||||
<picketlink.version>2.7.0.Final</picketlink.version>
|
<picketlink.version>2.7.0.Final</picketlink.version>
|
||||||
<mongo.driver.version>2.11.3</mongo.driver.version>
|
<mongo.driver.version>3.2.0</mongo.driver.version>
|
||||||
<jboss.logging.version>3.1.4.GA</jboss.logging.version>
|
<jboss.logging.version>3.1.4.GA</jboss.logging.version>
|
||||||
<syslog4j.version>0.9.30</syslog4j.version>
|
<syslog4j.version>0.9.30</syslog4j.version>
|
||||||
<jboss-logging-tools.version>1.2.0.Beta1</jboss-logging-tools.version>
|
<jboss-logging-tools.version>1.2.0.Beta1</jboss-logging-tools.version>
|
||||||
|
|
|
@ -16,8 +16,8 @@ import org.w3c.dom.Document;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.mongodb.util.MyAsserts.assertFalse;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLSERVLETDEMO;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLSERVLETDEMO;
|
||||||
import static org.keycloak.testsuite.util.IOUtil.*;
|
import static org.keycloak.testsuite.util.IOUtil.*;
|
||||||
|
|
Loading…
Reference in a new issue