diff --git a/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapConfigSecurityStore.java b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapConfigSecurityStore.java index c1f2db6e83..d55f18a6c9 100644 --- a/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapConfigSecurityStore.java +++ b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapConfigSecurityStore.java @@ -81,7 +81,7 @@ public SecurityInfo getByIdentity(String identity) { @Override public List getAllByEndpoint(String endpoint) { - BootstrapConfig bsConfig = bootstrapConfigStore.get(endpoint, null); + BootstrapConfig bsConfig = bootstrapConfigStore.get(endpoint, null, null); if (bsConfig == null || bsConfig.security == null) return null; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapIntegrationTestHelper.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapIntegrationTestHelper.java index 561554b62e..734188d65e 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapIntegrationTestHelper.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapIntegrationTestHelper.java @@ -48,6 +48,7 @@ import org.eclipse.leshan.server.bootstrap.BootstrapConfig.ServerConfig; import org.eclipse.leshan.server.bootstrap.BootstrapConfig.ServerSecurity; import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore; +import org.eclipse.leshan.server.bootstrap.BootstrapSession; import org.eclipse.leshan.server.californium.LeshanBootstrapServerBuilder; import org.eclipse.leshan.server.californium.impl.LeshanBootstrapServer; import org.eclipse.leshan.server.security.BootstrapSecurityStore; @@ -233,7 +234,7 @@ public BootstrapConfigStore unsecuredBootstrapStore() { return new BootstrapConfigStore() { @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { BootstrapConfig bsConfig = new BootstrapConfig(); @@ -277,7 +278,7 @@ public BootstrapConfigStore deleteSecurityStore(final String... pathToDelete) { return new BootstrapConfigStore() { @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { BootstrapConfig bsConfig = new BootstrapConfig(); bsConfig.toDelete = Arrays.asList(pathToDelete); @@ -290,7 +291,7 @@ public BootstrapConfigStore unsecuredWithAclBootstrapStore() { return new BootstrapConfigStore() { @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { BootstrapConfig bsConfig = new BootstrapConfig(); @@ -341,7 +342,7 @@ public BootstrapConfigStore pskBootstrapStore() { return new BootstrapConfigStore() { @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { BootstrapConfig bsConfig = new BootstrapConfig(); @@ -378,7 +379,7 @@ public BootstrapConfigStore rpkBootstrapStore() { return new BootstrapConfigStore() { @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { BootstrapConfig bsConfig = new BootstrapConfig(); diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilderTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilderTest.java index 0f03235e14..31a0271075 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilderTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilderTest.java @@ -22,6 +22,7 @@ import org.eclipse.leshan.core.request.Identity; import org.eclipse.leshan.server.bootstrap.BootstrapConfig; import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore; +import org.eclipse.leshan.server.bootstrap.BootstrapSession; import org.eclipse.leshan.server.californium.impl.LeshanBootstrapServer; import org.eclipse.leshan.server.security.BootstrapSecurityStore; import org.eclipse.leshan.server.security.SecurityInfo; @@ -38,7 +39,7 @@ public void start() { builder = new LeshanBootstrapServerBuilder(); builder.setConfigStore(new BootstrapConfigStore() { @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { return null; } }); diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/BootstrapConfigStore.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/BootstrapConfigStore.java index 57a011c683..c808d98c0d 100644 --- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/BootstrapConfigStore.java +++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/BootstrapConfigStore.java @@ -27,7 +27,8 @@ public interface BootstrapConfigStore { * * @param endpoint the endpoint of the device. * @param deviceIdentity the {@link Identity} the device. + * @param session the current {@link BootstrapSession}. * @return the {@link BootstrapConfig} to apply. */ - BootstrapConfig get(String endpoint, Identity deviceIdentity); + BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session); } diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java index 0012ae8d64..1946f2e91a 100644 --- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java +++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java @@ -116,7 +116,7 @@ public SendableResponse bootstrap(Identity sender, BootstrapR try { // Get the desired bootstrap config for the endpoint - final BootstrapConfig cfg = store.get(endpoint, sender); + final BootstrapConfig cfg = store.get(endpoint, sender, session); if (cfg == null) { LOG.debug("No bootstrap config for {}", session); stopSession(session, NO_BOOTSTRAP_CONFIG); diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/InMemoryBootstrapConfigStore.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/InMemoryBootstrapConfigStore.java index 6d85339141..513ce5ca73 100644 --- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/InMemoryBootstrapConfigStore.java +++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/InMemoryBootstrapConfigStore.java @@ -30,7 +30,7 @@ public class InMemoryBootstrapConfigStore implements EditableBootstrapConfigStor protected final Map bootstrapByEndpoint = new ConcurrentHashMap<>(); @Override - public BootstrapConfig get(String endpoint, Identity deviceIdentity) { + public BootstrapConfig get(String endpoint, Identity deviceIdentity, BootstrapSession session) { return bootstrapByEndpoint.get(endpoint); }