change credential mechanism #22920, upgrade to 1.12.0-SNAPSHOT

This commit is contained in:
Roberto Cirillo 2022-03-07 17:34:06 +01:00
parent c2d43b4707
commit ae9ff43fc6
4 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,8 @@
# Changelog for storage-manager-trigger
## [v1.12.0-SNAPSHOT] 2022-03-07
* change mongodb authentication mechanism. It was mongodbcr now it is handshaked from client and server. fix incident #22920
## [v1.11.1-SNAPSHOT]
* moved from UmaJWTProvider to AccessTokenProvider

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-trigger</artifactId>
<version>1.11.1-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
<scm>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm>

View File

@ -116,7 +116,7 @@ public class ReadingMongoOplog extends Thread{
boolean auth =false;
logger.info("try to auth ");
if(user!=null && password !=null){
MongoCredential credential = MongoCredential.createMongoCRCredential(user, "admin", password.toCharArray());
MongoCredential credential = MongoCredential.createCredential(user, "admin", password.toCharArray());
logger.debug("try to connect to mongo with authentication... ");
mongoClient = new MongoClient(Arrays.asList(server), Arrays.asList(credential), options);//"146.48.123.71"

View File

@ -128,7 +128,7 @@ public class MongoDB {
MongoClientOptions options=MongoClientOptions.builder().sslEnabled(true).connectionsPerHost(10).connectTimeout(30000).readPreference(READ_PREFERENCE).build();
// MongoClientOptions options=MongoClientOptions.builder().connectionsPerHost(10).connectTimeout(30000).readPreference(READ_PREFERENCE).build();
if(((pwd != null) && (pwd.length() >0)) && ((user != null) && (user.length() > 0))){
MongoCredential credential = MongoCredential.createMongoCRCredential(user, ACCOUNTING_DB, pwd.toCharArray());
MongoCredential credential = MongoCredential.createCredential(user, ACCOUNTING_DB, pwd.toCharArray());
mongo = new MongoClient(srvList, Arrays.asList(credential), options);
}else{
mongo = new MongoClient(srvList, options);