diff options
author | Morten Tokle <mortent@yahooinc.com> | 2023-04-28 11:00:39 +0200 |
---|---|---|
committer | Morten Tokle <mortent@yahooinc.com> | 2023-04-28 11:00:39 +0200 |
commit | 5396a7c1aad6c471f16be1e555dd752009053858 (patch) | |
tree | aa14f2feb5d71968218c91fe6e79934c3cfb8b81 /vespa-athenz/src/test/java | |
parent | f5dd3cb5d31875cf596adc01f2207f690afe553f (diff) |
Include roles from logfwarder config in identity document
Diffstat (limited to 'vespa-athenz/src/test/java')
2 files changed, 12 insertions, 5 deletions
diff --git a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapperTest.java b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapperTest.java index 513fb4cdbd3..cf5e02bfd79 100644 --- a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapperTest.java +++ b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapperTest.java @@ -7,9 +7,11 @@ import org.junit.jupiter.api.Test; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Base64; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -47,6 +49,7 @@ class EntityBindingsMapperTest { assertTrue(json.contains(expectedMemberInJson), () -> "Expected JSON to contain '%s', but got \n'%s'".formatted(expectedMemberInJson, json)); assertEquals(EntityBindingsMapper.mapper.readTree(originalJson), EntityBindingsMapper.mapper.readTree(json)); + assertEquals(List.of(), entity.identityDocument().roles()); } @Test @@ -84,4 +87,6 @@ class EntityBindingsMapperTest { assertEquals(EntityBindingsMapper.mapper.readTree(originalJson), EntityBindingsMapper.mapper.readTree(json)); } + + }
\ No newline at end of file diff --git a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/client/IdentityDocumentSignerTest.java b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/client/IdentityDocumentSignerTest.java index acb0905700f..334e0208c77 100644 --- a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/client/IdentityDocumentSignerTest.java +++ b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/client/IdentityDocumentSignerTest.java @@ -19,6 +19,7 @@ import java.security.KeyPair; import java.time.Instant; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import static com.yahoo.vespa.athenz.identityprovider.api.IdentityType.TENANT; import static com.yahoo.vespa.athenz.identityprovider.api.SignedIdentityDocument.LEGACY_DEFAULT_DOCUMENT_VERSION; @@ -44,13 +45,14 @@ public class IdentityDocumentSignerTest { private static final ClusterType clusterType = ClusterType.CONTAINER; private static final String ztsUrl = "https://foo"; private static final AthenzIdentity serviceIdentity = new AthenzService("vespa", "node"); + private static final List<String> roles = List.of(); @Test void legacy_generates_and_validates_signature() { IdentityDocumentSigner signer = new IdentityDocumentSigner(); IdentityDocument identityDocument = new IdentityDocument( id, providerService, configserverHostname, - instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity); + instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity, roles); String signature = signer.generateLegacySignature(identityDocument, keyPair.getPrivate()); @@ -65,7 +67,7 @@ public class IdentityDocumentSignerTest { IdentityDocumentSigner signer = new IdentityDocumentSigner(); IdentityDocument identityDocument = new IdentityDocument( id, providerService, configserverHostname, - instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity); + instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity, roles); String data = EntityBindingsMapper.toIdentityDocmentData(identityDocument); String signature = signer.generateSignature(data, keyPair.getPrivate()); @@ -81,10 +83,10 @@ public class IdentityDocumentSignerTest { IdentityDocumentSigner signer = new IdentityDocumentSigner(); IdentityDocument identityDocument = new IdentityDocument( id, providerService, configserverHostname, - instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity); + instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity, roles); IdentityDocument withoutIgnoredFields = new IdentityDocument( id, providerService, configserverHostname, - instanceHostname, createdAt, ipAddresses, identityType, null, null, serviceIdentity); + instanceHostname, createdAt, ipAddresses, identityType, null, null, serviceIdentity, roles); String signature = signer.generateLegacySignature(identityDocument, keyPair.getPrivate()); @@ -103,7 +105,7 @@ public class IdentityDocumentSignerTest { IdentityDocumentSigner signer = new IdentityDocumentSigner(); IdentityDocument identityDocument = new IdentityDocument( id, providerService, configserverHostname, - instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity); + instanceHostname, createdAt, ipAddresses, identityType, clusterType, ztsUrl, serviceIdentity, roles); String signature = signer.generateLegacySignature(identityDocument, keyPair.getPrivate()); |