Skip to content

Commit a851377

Browse files
Merge pull request #252 from FlorianWege-IESE/mongodb-access-control-boot-up-fix
Fix access control preventing mongodb boot up loading
2 parents a67de21 + 5993d9d commit a851377

File tree

2 files changed

+10
-3
lines changed
  • basyx.components/basyx.components.docker

2 files changed

+10
-3
lines changed

basyx.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/AASServerComponent.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ private VABHTTPInterface<?> createAggregatorServlet() {
540540

541541
private IAASAggregator createAASAggregator() {
542542
if (isMongoDBBackend()) {
543-
return new MongoDBAASServerComponentFactory(createMongoDbConfiguration(), createAASServerDecoratorList(), registry).create();
543+
try (final var ignored = ElevatedCodeAuthentication.enterElevatedCodeAuthenticationArea()) {
544+
return new MongoDBAASServerComponentFactory(createMongoDbConfiguration(), createAASServerDecoratorList(), registry).create();
545+
}
544546
}
545547
return new InMemoryAASServerComponentFactory(createAASServerDecoratorList(), registry).create();
546548
}

basyx.components/basyx.components.docker/basyx.components.registry/src/main/java/org/eclipse/basyx/components/registry/RegistryComponent.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.eclipse.basyx.components.security.authorization.internal.IJwtBearerTokenAuthenticationConfigurationProvider;
5353
import org.eclipse.basyx.extensions.aas.directory.tagged.api.IAASTaggedDirectory;
5454
import org.eclipse.basyx.extensions.aas.directory.tagged.map.MapTaggedDirectory;
55+
import org.eclipse.basyx.extensions.shared.authorization.internal.ElevatedCodeAuthentication;
5556
import org.eclipse.basyx.extensions.shared.encoding.Base64URLEncoder;
5657
import org.eclipse.basyx.extensions.shared.encoding.URLEncoder;
5758
import org.eclipse.basyx.vab.protocol.http.server.BaSyxContext;
@@ -263,7 +264,9 @@ private HttpServlet createTaggedRegistryServlet() {
263264
logger.info("Enable tagged directory functionality");
264265
IAASTaggedDirectory taggedDirectory;
265266
if (registryConfig.getRegistryBackend().equals(RegistryBackend.MONGODB)) {
266-
taggedDirectory = new MongoDBTaggedDirectory(loadMongoDBConfiguration(), new HashMap<>());
267+
try (final var ignored = ElevatedCodeAuthentication.enterElevatedCodeAuthenticationArea()) {
268+
taggedDirectory = new MongoDBTaggedDirectory(loadMongoDBConfiguration(), new HashMap<>());
269+
}
267270
} else {
268271
taggedDirectory = new MapTaggedDirectory(new HashedMap<>(), new HashedMap<>());
269272
}
@@ -336,7 +339,9 @@ private IAASRegistry createSQLRegistryBackend() {
336339
private IAASRegistry createMongoDBRegistryBackend() {
337340
logger.info("Creating MongoDBRegistry");
338341
final BaSyxMongoDBConfiguration mongoDBConfiguration = loadMongoDBConfiguration();
339-
return new MongoDBRegistry(mongoDBConfiguration);
342+
try (final var ignored = ElevatedCodeAuthentication.enterElevatedCodeAuthenticationArea()) {
343+
return new MongoDBRegistry(mongoDBConfiguration);
344+
}
340345
}
341346

342347
private IAASRegistry decorate(IAASRegistry aasRegistry) {

0 commit comments

Comments
 (0)