feat: publish application permissions to DDS grants

This commit is contained in:
devmrko
2026-06-30 07:51:36 +09:00
parent 2e4bcef44f
commit 1e48864bce
15 changed files with 841 additions and 12 deletions

View File

@@ -7,6 +7,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
class DdsPropertiesTest {
@@ -33,4 +36,24 @@ class DdsPropertiesTest {
"jdbc:test", Duration.ofSeconds(5), "ADMIN.VIEW;DROP", "ADMIN.VIEW", Map.of()
));
}
@Test
void bindsApplicationUserAndDataRoleForDdsProvisioning() {
var source = new MapConfigurationPropertySource(Map.of(
"dds.users.my.label", "MY",
"dds.users.my.description", "source",
"dds.users.my.username", "ddsuser_my",
"dds.users.my.password", "secret",
"dds.users.my.application-user-id", "101",
"dds.users.my.data-role", "dds_demo_my_role"
));
var properties = new Binder(source)
.bind("dds", Bindable.of(DdsProperties.class))
.orElseThrow(() -> new AssertionError("dds properties did not bind"));
assertEquals(101L, properties.users().get("my").applicationUserId());
assertEquals("dds_demo_my_role", properties.users().get("my").dataRole());
assertTrue(properties.users().get("my").mapped());
}
}