diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthentication.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthentication.java index 16c89239..edfb40e6 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthentication.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthentication.java @@ -39,7 +39,7 @@ import org.springframework.web.client.RestOperations; * ID * @deprecated since 2.2. Use {@link AppRoleAuthentication}. */ -@Deprecated +@Deprecated(since = "2.2", forRemoval = true) public class AppIdAuthentication implements ClientAuthentication, AuthenticationStepsFactory { private static final Log logger = LogFactory.getLog(AppIdAuthentication.class); diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthenticationOptions.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthenticationOptions.java index 6feb3c5f..c7143fd7 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthenticationOptions.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdAuthenticationOptions.java @@ -30,7 +30,7 @@ import org.springframework.util.Assert; * @see #builder() * @deprecated since 2.2. Use {@link AppRoleAuthentication}. */ -@Deprecated +@Deprecated(since = "2.2", forRemoval = true) public class AppIdAuthenticationOptions { public static final String DEFAULT_APPID_AUTHENTICATION_PATH = "app-id"; diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdUserIdMechanism.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdUserIdMechanism.java index 23ba3382..afa6a30e 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdUserIdMechanism.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppIdUserIdMechanism.java @@ -24,7 +24,7 @@ package org.springframework.vault.authentication; * @see AppIdAuthentication * @deprecated since 2.2. Use {@link AppRoleAuthentication}. */ -@Deprecated +@Deprecated(since = "2.2", forRemoval = true) @FunctionalInterface public interface AppIdUserIdMechanism { diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppRoleAuthenticationOptions.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppRoleAuthenticationOptions.java index b4f813a1..ef31ad23 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppRoleAuthenticationOptions.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AppRoleAuthenticationOptions.java @@ -65,24 +65,14 @@ public class AppRoleAuthenticationOptions { */ private final UnwrappingEndpoints unwrappingEndpoints; - /** - * Token associated for pull mode (retrieval of secretId/roleId). - * @deprecated since 2.0, use {@link RoleId#pull(VaultToken)}/ - * {@link SecretId#pull(VaultToken)} to configure pull mode for roleId/secretId. - */ - @Nullable - @Deprecated - private final VaultToken initialToken; - private AppRoleAuthenticationOptions(String path, RoleId roleId, SecretId secretId, @Nullable String appRole, - UnwrappingEndpoints unwrappingEndpoints, @Nullable VaultToken initialToken) { + UnwrappingEndpoints unwrappingEndpoints) { this.path = path; this.roleId = roleId; this.secretId = secretId; this.appRole = appRole; this.unwrappingEndpoints = unwrappingEndpoints; - this.initialToken = initialToken; } /** @@ -130,18 +120,6 @@ public class AppRoleAuthenticationOptions { return this.unwrappingEndpoints; } - /** - * @return the initial token for roleId/secretId retrieval in pull mode. - * @since 1.1 - * @deprecated since 2.0, use {@link #getRoleId()}/{@link #getSecretId()} to obtain - * configuration modes (pull/wrapped) for an AppRole token. - */ - @Nullable - @Deprecated - public VaultToken getInitialToken() { - return this.initialToken; - } - /** * Builder for {@link AppRoleAuthenticationOptions}. */ @@ -166,10 +144,6 @@ public class AppRoleAuthenticationOptions { private UnwrappingEndpoints unwrappingEndpoints = UnwrappingEndpoints.SysWrapping; - @Nullable - @Deprecated - private VaultToken initialToken; - AppRoleAuthenticationOptionsBuilder() { } @@ -201,22 +175,6 @@ public class AppRoleAuthenticationOptions { return this; } - /** - * Configure the RoleId. - * @param roleId must not be empty or {@literal null}. - * @return {@code this} {@link AppRoleAuthenticationOptionsBuilder}. - * @deprecated since 2.0, use - * {@link #roleId(AppRoleAuthenticationOptions.RoleId)}. - */ - @Deprecated - public AppRoleAuthenticationOptionsBuilder roleId(String roleId) { - - Assert.hasText(roleId, "RoleId must not be empty"); - - this.providedRoleId = roleId; - return this; - } - /** * Configure a {@code secretId}. * @param secretId must not be empty or {@literal null}. @@ -231,22 +189,6 @@ public class AppRoleAuthenticationOptions { return this; } - /** - * Configure a {@code secretId}. - * @param secretId must not be empty or {@literal null}. - * @return {@code this} {@link AppRoleAuthenticationOptionsBuilder}. - * @deprecated since 2.0, use - * {@link #secretId(AppRoleAuthenticationOptions.SecretId)}. - */ - @Deprecated - public AppRoleAuthenticationOptionsBuilder secretId(String secretId) { - - Assert.hasText(secretId, "SecretId must not be empty"); - - this.providedSecretId = secretId; - return this; - } - /** * Configure a {@code appRole}. * @param appRole must not be empty or {@literal null}. @@ -275,28 +217,10 @@ public class AppRoleAuthenticationOptions { return this; } - /** - * Configure a {@code initialToken}. - * @param initialToken must not be empty or {@literal null}. - * @return {@code this} {@link AppRoleAuthenticationOptionsBuilder}. - * @since 1.1 - * @deprecated since 2.0, use - * {@link #roleId(AppRoleAuthenticationOptions.RoleId)}/{@link #secretId(AppRoleAuthenticationOptions.SecretId)} - * to configure pull mode. - */ - @Deprecated - public AppRoleAuthenticationOptionsBuilder initialToken(VaultToken initialToken) { - - Assert.notNull(initialToken, "InitialToken must not be null"); - - this.initialToken = initialToken; - return this; - } - /** * Build a new {@link AppRoleAuthenticationOptions} instance. Requires - * {@link #roleId(String)} for push mode or {@link #appRole(String)} and - * {@link #initialToken(VaultToken)} for pull mode to be configured. + * {@link #roleId(RoleId)} for push mode or {@link #appRole(String)} and + * {@link #secretId SecretId.pull(VaultToken)} for pull mode to be configured. * @return a new {@link AppRoleAuthenticationOptions}. */ public AppRoleAuthenticationOptions build() { @@ -308,9 +232,6 @@ public class AppRoleAuthenticationOptions { if (this.providedSecretId != null) { secretId(SecretId.provided(this.providedSecretId)); } - else if (this.initialToken != null) { - secretId(SecretId.pull(this.initialToken)); - } else { secretId(SecretId.absent()); } @@ -318,15 +239,9 @@ public class AppRoleAuthenticationOptions { if (this.roleId == null) { - if (this.providedRoleId != null) { - roleId(RoleId.provided(this.providedRoleId)); - } - else { - - Assert.notNull(this.initialToken, - "AppRole authentication configured for pull mode. InitialToken must not be null (pull mode)"); - roleId(RoleId.pull(this.initialToken)); - } + Assert.notNull(this.providedRoleId, + "AppRole authentication configured for pull mode. Role Identifier must be provided."); + roleId(RoleId.provided(this.providedRoleId)); } if (this.roleId instanceof Pull || this.secretId instanceof Pull) { @@ -335,7 +250,7 @@ public class AppRoleAuthenticationOptions { } return new AppRoleAuthenticationOptions(this.path, this.roleId, this.secretId, this.appRole, - this.unwrappingEndpoints, this.initialToken); + this.unwrappingEndpoints); } } diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AwsIamAuthenticationOptions.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AwsIamAuthenticationOptions.java index 426b195f..0f35084e 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/AwsIamAuthenticationOptions.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/AwsIamAuthenticationOptions.java @@ -138,17 +138,6 @@ public class AwsIamAuthenticationOptions { return this.serverId; } - /** - * @return Server name to mitigate risk of replay attacks, preferably set to Vault - * server's DNS name, may be {@literal null}. - * @deprecated since 2.0, renamed to {@link #getServerId()}. - */ - @Nullable - @Deprecated - public String getServerName() { - return this.serverId; - } - /** * @return STS server URI. */ diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthentication.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthentication.java index 172af6c7..3958774c 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthentication.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthentication.java @@ -68,7 +68,7 @@ import org.springframework.web.client.RestOperations; * projects.serviceAccounts.signJwt * @deprecated since 2.3.2, use {@link GcpIamCredentialsAuthentication} instead. */ -@Deprecated +@Deprecated(since = "2.3.2", forRemoval = true) public class GcpIamAuthentication extends GcpJwtAuthenticationSupport implements ClientAuthentication { private static final String SCOPE = "https://www.googleapis.com/auth/iam"; diff --git a/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthenticationOptions.java b/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthenticationOptions.java index d724920a..3cf47753 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthenticationOptions.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/authentication/GcpIamAuthenticationOptions.java @@ -38,7 +38,7 @@ import org.springframework.util.Assert; * @since 2.1 * @deprecated since 2.3.2 */ -@Deprecated +@Deprecated(since = "2.3.2", forRemoval = true) public class GcpIamAuthenticationOptions extends GcpIamAuthenticationSupport { public static final String DEFAULT_GCP_AUTHENTICATION_PATH = "gcp"; diff --git a/spring-vault-core/src/main/java/org/springframework/vault/support/Policy.java b/spring-vault-core/src/main/java/org/springframework/vault/support/Policy.java index c5803181..b619e8e6 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/support/Policy.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/support/Policy.java @@ -548,7 +548,7 @@ public class Policy { * {@link #CREATE} and {@link #UPDATE}. * @deprecated since 2.3 and Vault 0.5. */ - @Deprecated + @Deprecated(since = "2.3") WRITE, /** diff --git a/spring-vault-core/src/main/java/org/springframework/vault/support/SslConfiguration.java b/spring-vault-core/src/main/java/org/springframework/vault/support/SslConfiguration.java index e591a071..be68025b 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/support/SslConfiguration.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/support/SslConfiguration.java @@ -68,25 +68,6 @@ public class SslConfiguration { private final List enabledCipherSuites; - /** - * Create a new {@link SslConfiguration} with the default {@link KeyStore} type. - * @param keyStore the key store resource, must not be {@literal null}. - * @param keyStorePassword the key store password. - * @param trustStore the trust store resource, must not be {@literal null}. - * @param trustStorePassword the trust store password. - * @deprecated Since 1.1, use - * {@link #SslConfiguration(KeyStoreConfiguration, KeyStoreConfiguration)} to prevent - * {@link String} interning and retaining passwords represented as String longer from - * GC than necessary. - */ - @Deprecated - public SslConfiguration(Resource keyStore, @Nullable String keyStorePassword, Resource trustStore, - @Nullable String trustStorePassword) { - - this(new KeyStoreConfiguration(keyStore, charsOrNull(keyStorePassword), DEFAULT_KEYSTORE_TYPE), - new KeyStoreConfiguration(trustStore, charsOrNull(trustStorePassword), DEFAULT_KEYSTORE_TYPE)); - } - /** * Create a new {@link SslConfiguration}. * @param keyStoreConfiguration the key store configuration, must not be @@ -174,23 +155,6 @@ public class SslConfiguration { enabledCipherSuites); } - /** - * Create a new {@link SslConfiguration} for the given trust store with the default - * {@link KeyStore} type. - * @param trustStore resource pointing to an existing trust store, must not be - * {@literal null}. - * @param trustStorePassword may be {@literal null}. - * @return the created {@link SslConfiguration}. - * @see java.security.KeyStore - * @deprecated Since 1.1, use {@link #forTrustStore(Resource, char[])} to prevent - * {@link String} interning and retaining passwords represented as String longer from - * GC than necessary. - */ - @Deprecated - public static SslConfiguration forTrustStore(Resource trustStore, @Nullable String trustStorePassword) { - return forTrustStore(trustStore, charsOrNull(trustStorePassword)); - } - /** * Create a new {@link SslConfiguration} for the given trust store with the default * {@link KeyStore} type. @@ -222,23 +186,6 @@ public class SslConfiguration { return unconfigured().withTrustStore(trustStore); } - /** - * Create a new {@link SslConfiguration} for the given key store with the default - * {@link KeyStore} type. - * @param keyStore resource pointing to an existing key store, must not be - * {@literal null}. - * @param keyStorePassword may be {@literal null}. - * @return the created {@link SslConfiguration}. - * @see java.security.KeyStore - * @deprecated Since 1.1, use {@link #forKeyStore(Resource, char[])} to prevent - * {@link String} interning and retaining passwords represented as String longer from - * GC than necessary. - */ - @Deprecated - public static SslConfiguration forKeyStore(Resource keyStore, @Nullable String keyStorePassword) { - return forKeyStore(keyStore, charsOrNull(keyStorePassword)); - } - /** * Create a new {@link SslConfiguration} for the given key store with the default * {@link KeyStore} type. @@ -304,27 +251,6 @@ public class SslConfiguration { keyConfiguration, KeyStoreConfiguration.unconfigured()); } - /** - * Create a new {@link SslConfiguration} for the given truststore with the default - * {@link KeyStore} type. - * @param keyStore resource pointing to an existing keystore, must not be - * {@literal null}. - * @param keyStorePassword may be {@literal null}. - * @param trustStore resource pointing to an existing trust store, must not be - * {@literal null}. - * @param trustStorePassword may be {@literal null}. - * @return the created {@link SslConfiguration}. - * @see java.security.KeyStore - * @deprecated Since 1.1, use {@link #create(Resource, char[], Resource, char[])} to - * prevent {@link String} interning and retaining passwords represented as String - * longer from GC than necessary. - */ - @Deprecated - public SslConfiguration create(Resource keyStore, @Nullable String keyStorePassword, Resource trustStore, - @Nullable String trustStorePassword) { - return create(keyStore, charsOrNull(keyStorePassword), trustStore, charsOrNull(trustStorePassword)); - } - /** * Create a new {@link SslConfiguration} for the given truststore with the default * {@link KeyStore} type. diff --git a/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignRequest.java b/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignRequest.java index 544b8acd..2cbb4343 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignRequest.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignRequest.java @@ -89,7 +89,7 @@ public class VaultSignRequest { * default algorithm. * @deprecated since 2.4, use {@link #getSignatureAlgorithm()} instead. */ - @Deprecated + @Deprecated(since = "2.4") @Nullable public String getAlgorithm() { return getSignatureAlgorithm(); @@ -159,7 +159,7 @@ public class VaultSignRequest { * @return {@code this} {@link VaultSignRequestBuilder}. * @deprecated since 2.4, use {@link #signatureAlgorithm(String)} instead. */ - @Deprecated + @Deprecated(since = "2.4") public VaultSignRequestBuilder algorithm(String algorithm) { return signatureAlgorithm(algorithm); } diff --git a/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignatureVerificationRequest.java b/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignatureVerificationRequest.java index 968ab1b5..8d315f1a 100644 --- a/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignatureVerificationRequest.java +++ b/spring-vault-core/src/main/java/org/springframework/vault/support/VaultSignatureVerificationRequest.java @@ -130,7 +130,7 @@ public class VaultSignatureVerificationRequest { * @deprecated since 2.4, use {@link #getSignatureAlgorithm()} instead. */ @Nullable - @Deprecated + @Deprecated(since = "2.4") public String getAlgorithm() { return getSignatureAlgorithm(); } @@ -237,7 +237,7 @@ public class VaultSignatureVerificationRequest { * @return {@code this} {@link VaultSignatureVerificationRequestBuilder}. * @deprecated since 2.4, use {@link #signatureAlgorithm(String)} instead. */ - @Deprecated + @Deprecated(since = "2.4") public VaultSignatureVerificationRequestBuilder algorithm(String algorithm) { return signatureAlgorithm(algorithm); } diff --git a/spring-vault-core/src/test/java/org/springframework/vault/authentication/AppRoleAuthenticationUnitTests.java b/spring-vault-core/src/test/java/org/springframework/vault/authentication/AppRoleAuthenticationUnitTests.java index 85f0a29e..8089f1d5 100644 --- a/spring-vault-core/src/test/java/org/springframework/vault/authentication/AppRoleAuthenticationUnitTests.java +++ b/spring-vault-core/src/test/java/org/springframework/vault/authentication/AppRoleAuthenticationUnitTests.java @@ -91,7 +91,8 @@ class AppRoleAuthenticationUnitTests { void loginShouldPullRoleIdAndSecretId() { AppRoleAuthenticationOptions options = AppRoleAuthenticationOptions.builder().appRole("app_role") - .initialToken(VaultToken.of("initial_token")).build(); + .roleId(RoleId.pull(VaultToken.of("initial_token"))) + .secretId(SecretId.pull(VaultToken.of("initial_token"))).build(); this.mockRest.expect(requestTo("/auth/approle/role/app_role/role-id")).andExpect(method(HttpMethod.GET)) .andExpect(header("X-Vault-token", "initial_token")).andRespond(withSuccess() @@ -119,12 +120,6 @@ class AppRoleAuthenticationUnitTests { assertThatIllegalArgumentException().isThrownBy(() -> AppRoleAuthenticationOptions.builder().build()); } - @Test - void optionsShouldRequireTokenOrRoleIdIfTokenIsSet() { - assertThatIllegalArgumentException() - .isThrownBy(() -> AppRoleAuthenticationOptions.builder().initialToken(VaultToken.of("foo")).build()); - } - @Test void optionsShouldRequireTokenOrRoleIdIfAppRoleIdIsSet() { assertThatIllegalArgumentException()