diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2018-07-10 15:28:47 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2018-07-25 16:38:50 +0200 |
commit | 50814bf4ce9b984d8ac3fe559541d9dc5f47f0d4 (patch) | |
tree | 2c214319a5e4aa9ed32591770aefcf5ab9eeff6b /vespa-athenz/src/test | |
parent | 3a9d916073fa1f90610fdc219d3214b0fb3b2223 (diff) |
Handle zms keys in addition to zts keys
Diffstat (limited to 'vespa-athenz/src/test')
-rw-r--r-- | vespa-athenz/src/test/java/com/yahoo/vespa/athenz/utils/ntoken/NTokenValidatorTest.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/utils/ntoken/NTokenValidatorTest.java b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/utils/ntoken/NTokenValidatorTest.java index 0e70993792f..22f97ca8b60 100644 --- a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/utils/ntoken/NTokenValidatorTest.java +++ b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/utils/ntoken/NTokenValidatorTest.java @@ -15,6 +15,7 @@ import org.junit.rules.ExpectedException; import java.security.KeyPair; import java.security.PrivateKey; +import java.security.PublicKey; import java.time.Instant; import java.util.Optional; @@ -68,7 +69,17 @@ public class NTokenValidatorTest { } private static AthenzTruststore createTruststore() { - return keyId -> keyId.equals("0") ? Optional.of(TRUSTED_KEY.getPublic()) : Optional.empty(); + return new AthenzTruststore() { + @Override + public Optional<PublicKey> getZmsPublicKey(String keyId) { + return keyId.equals("0") ? Optional.of(TRUSTED_KEY.getPublic()) : Optional.empty(); + } + + @Override + public Optional<PublicKey> getZtsPublicKey(String keyId) { + return Optional.empty(); + } + }; } private static NToken createNToken(AthenzIdentity identity, Instant issueTime, PrivateKey privateKey, String keyId) { @@ -77,6 +88,7 @@ public class NTokenValidatorTest { .salt("1234") .host("host") .ip("1.2.3.4") + .keyService("zms") .issueTime(issueTime.getEpochSecond()) .expirationWindow(1000) .build(); |