diff options
author | Morten Tokle <mortent@verizonmedia.com> | 2019-06-24 11:02:43 +0200 |
---|---|---|
committer | andreer <andreer@verizonmedia.com> | 2019-06-24 11:08:46 +0200 |
commit | e11f35d832c1beef87092114aa5ad3a81f1479a1 (patch) | |
tree | b3b261281b016db7858f2d06762409b368372881 /container-disc | |
parent | 7809e2a0d4b68779c03ffd3ce7fd3dab7162d4a4 (diff) |
Add SecretStoreProvider, deprecate old
Diffstat (limited to 'container-disc')
-rw-r--r-- | container-disc/src/main/java/com/yahoo/container/jdisc/DeprecatedSecretStoreProvider.java | 34 | ||||
-rw-r--r-- | container-disc/src/main/java/com/yahoo/container/jdisc/SecretStoreProvider.java | 23 |
2 files changed, 43 insertions, 14 deletions
diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/DeprecatedSecretStoreProvider.java b/container-disc/src/main/java/com/yahoo/container/jdisc/DeprecatedSecretStoreProvider.java new file mode 100644 index 00000000000..0f47bfe2eb1 --- /dev/null +++ b/container-disc/src/main/java/com/yahoo/container/jdisc/DeprecatedSecretStoreProvider.java @@ -0,0 +1,34 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.container.jdisc; + +import com.yahoo.container.di.componentgraph.Provider; + +/** + * An secret store provider which provides a factory which throws exception on + * invocation - as no secret store is currently provided by default. + * The purpose of this is to provide a secret store for injection in the case where + * no secret store component is provided. + * + * @author bratseth + */ +@SuppressWarnings({"deprecation", "unused"}) +public class DeprecatedSecretStoreProvider implements Provider<com.yahoo.jdisc.http.SecretStore> { + + private static final ThrowingSecretStore instance = new ThrowingSecretStore(); + + @Override + public com.yahoo.jdisc.http.SecretStore get() { return instance; } + + @Override + public void deconstruct() { } + + private static final class ThrowingSecretStore implements com.yahoo.jdisc.http.SecretStore { + + @Override + public String getSecret(String key) { + throw new UnsupportedOperationException("A secret store is not available"); + } + + } + +} diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/SecretStoreProvider.java b/container-disc/src/main/java/com/yahoo/container/jdisc/SecretStoreProvider.java index d966e66f502..6012fbe394c 100644 --- a/container-disc/src/main/java/com/yahoo/container/jdisc/SecretStoreProvider.java +++ b/container-disc/src/main/java/com/yahoo/container/jdisc/SecretStoreProvider.java @@ -1,34 +1,29 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.container.jdisc; +import com.yahoo.container.jdisc.secretstore.SecretStore; import com.yahoo.container.di.componentgraph.Provider; -/** - * An secret store provider which provides a factory which throws exception on - * invocation - as no secret store is currently provided by default. - * The purpose of this is to provide a secret store for injection in the case where - * no secret store component is provided. - * - * @author bratseth - */ -@SuppressWarnings({"deprecation", "unused"}) -public class SecretStoreProvider implements Provider<com.yahoo.jdisc.http.SecretStore> { +public class SecretStoreProvider implements Provider<SecretStore> { private static final ThrowingSecretStore instance = new ThrowingSecretStore(); @Override - public com.yahoo.jdisc.http.SecretStore get() { return instance; } + public SecretStore get() { return instance; } @Override public void deconstruct() { } - private static final class ThrowingSecretStore implements com.yahoo.jdisc.http.SecretStore { + private static final class ThrowingSecretStore implements SecretStore { @Override public String getSecret(String key) { throw new UnsupportedOperationException("A secret store is not available"); } + @Override + public String getSecret(String key, int version) { + throw new UnsupportedOperationException("A secret store is not available"); + } } - } |