Removes spring-security-rsa (#1399)
In favor of merging into spring-security-crypto Fixes gh-1398
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -28,6 +28,7 @@
|
||||
<properties>
|
||||
<bintray.package>commons</bintray.package>
|
||||
<evictor.version>1.0.0</evictor.version>
|
||||
<bouncycastle-bcprov-jdk18on.version>1.78.1</bouncycastle-bcprov-jdk18on.version>
|
||||
<!-- Deprecated - reached EOL -->
|
||||
<spring-security-oauth2-autoconfigure.version>2.5.2</spring-security-oauth2-autoconfigure.version>
|
||||
</properties>
|
||||
@@ -169,6 +170,11 @@
|
||||
<artifactId>spring-cloud-test-support</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
<version>${bouncycastle-bcprov-jdk18on.version}</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
|
||||
@@ -15,25 +15,9 @@
|
||||
<name>spring-cloud-commons-dependencies</name>
|
||||
<description>Spring Cloud Commons Dependencies</description>
|
||||
<properties>
|
||||
<spring-security-rsa.version>1.1.5</spring-security-rsa.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-rsa</artifactId>
|
||||
<version>${spring-security-rsa.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
|
||||
@@ -131,11 +131,6 @@
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-rsa</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-jmx</artifactId>
|
||||
|
||||
@@ -166,6 +166,7 @@ class RetryableLoadBalancerExchangeFilterFunctionIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
void correctResponseReturnedAfterRetryingOnNextServiceInstanceWithBackoff() {
|
||||
loadBalancerProperties.getRetry().getBackoff().setEnabled(true);
|
||||
loadBalancerProperties.getRetry().setMaxRetriesOnSameServiceInstance(1);
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-rsa</artifactId>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -38,7 +38,12 @@ public class TextEncryptorConfigBootstrapper implements BootstrapRegistryInitial
|
||||
* RsaSecretEncryptor present.
|
||||
*/
|
||||
public static final boolean RSA_IS_PRESENT = ClassUtils
|
||||
.isPresent("org.springframework.security.rsa.crypto.RsaSecretEncryptor", null);
|
||||
.isPresent("org.springframework.security.crypto.encrypt.RsaSecretEncryptor", null);
|
||||
|
||||
/**
|
||||
* RsaSecretEncryptor present.
|
||||
*/
|
||||
public static final boolean BCPROV_IS_PRESENT = ClassUtils.isPresent("org.bouncycastle.asn1.ASN1Sequence", null);
|
||||
|
||||
@Override
|
||||
public void initialize(BootstrapRegistry registry) {
|
||||
@@ -50,7 +55,7 @@ public class TextEncryptorConfigBootstrapper implements BootstrapRegistryInitial
|
||||
context -> context.get(Binder.class)
|
||||
.bind(KeyProperties.PREFIX, KeyProperties.class)
|
||||
.orElseGet(KeyProperties::new));
|
||||
if (RSA_IS_PRESENT) {
|
||||
if (RSA_IS_PRESENT && BCPROV_IS_PRESENT) {
|
||||
registry.registerIfAbsent(RsaProperties.class,
|
||||
context -> context.get(Binder.class)
|
||||
.bind(RsaProperties.PREFIX, RsaProperties.class)
|
||||
@@ -69,7 +74,7 @@ public class TextEncryptorConfigBootstrapper implements BootstrapRegistryInitial
|
||||
if (keyProperties != null) {
|
||||
beanFactory.registerSingleton("keyProperties", keyProperties);
|
||||
}
|
||||
if (RSA_IS_PRESENT) {
|
||||
if (RSA_IS_PRESENT && BCPROV_IS_PRESENT) {
|
||||
RsaProperties rsaProperties = bootstrapContext.get(RsaProperties.class);
|
||||
if (rsaProperties != null) {
|
||||
beanFactory.registerSingleton("rsaProperties", rsaProperties);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.bootstrap.encrypt;
|
||||
|
||||
import org.bouncycastle.asn1.ASN1Sequence;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
@@ -32,8 +34,8 @@ import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import org.springframework.security.crypto.encrypt.RsaSecretEncryptor;
|
||||
import org.springframework.security.crypto.encrypt.TextEncryptor;
|
||||
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -73,7 +75,7 @@ public class EncryptionBootstrapConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Conditional(KeyCondition.class)
|
||||
@ConditionalOnClass(RsaSecretEncryptor.class)
|
||||
@ConditionalOnClass({ RsaSecretEncryptor.class, ASN1Sequence.class })
|
||||
@EnableConfigurationProperties
|
||||
protected static class RsaEncryptionConfiguration {
|
||||
|
||||
@@ -93,7 +95,7 @@ public class EncryptionBootstrapConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Conditional(KeyCondition.class)
|
||||
@ConditionalOnMissingClass("org.springframework.security.rsa.crypto.RsaSecretEncryptor")
|
||||
@ConditionalOnMissingClass("org.bouncycastle.asn1.ASN1Sequence")
|
||||
protected static class VanillaEncryptionConfiguration {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -30,7 +30,7 @@ class EncryptionRuntimeHints implements RuntimeHintsRegistrar {
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
hints.reflection()
|
||||
.registerTypeIfPresent(classLoader, "org.springframework.security.rsa.crypto.RsaSecretEncryptor",
|
||||
.registerTypeIfPresent(classLoader, "org.springframework.security.crypto.encrypt.RsaSecretEncryptor",
|
||||
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.cloud.bootstrap.encrypt;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.security.rsa.crypto.RsaAlgorithm;
|
||||
import org.springframework.security.crypto.encrypt.RsaAlgorithm;
|
||||
|
||||
/**
|
||||
* @author Ryan Baxter
|
||||
|
||||
@@ -31,12 +31,14 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.security.crypto.encrypt.KeyStoreKeyFactory;
|
||||
import org.springframework.security.crypto.encrypt.RsaSecretEncryptor;
|
||||
import org.springframework.security.crypto.encrypt.TextEncryptor;
|
||||
import org.springframework.security.rsa.crypto.KeyStoreKeyFactory;
|
||||
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.springframework.cloud.bootstrap.TextEncryptorConfigBootstrapper.BCPROV_IS_PRESENT;
|
||||
|
||||
public abstract class TextEncryptorUtils {
|
||||
|
||||
/**
|
||||
@@ -58,7 +60,7 @@ public abstract class TextEncryptorUtils {
|
||||
.orElseGet(KeyProperties::new);
|
||||
if (TextEncryptorUtils.keysConfigured(keyProperties)) {
|
||||
decryptor.setFailOnError(keyProperties.isFailOnError());
|
||||
if (ClassUtils.isPresent("org.springframework.security.rsa.crypto.RsaSecretEncryptor", null)) {
|
||||
if (ClassUtils.isPresent("org.springframework.security.crypto.encrypt.RsaSecretEncryptor", null)) {
|
||||
RsaProperties rsaProperties = binder.bind(RsaProperties.PREFIX, RsaProperties.class)
|
||||
.orElseGet(RsaProperties::new);
|
||||
return TextEncryptorUtils.createTextEncryptor(keyProperties, rsaProperties);
|
||||
@@ -78,7 +80,7 @@ public abstract class TextEncryptorUtils {
|
||||
registry.registerIfAbsent(TextEncryptor.class, context -> {
|
||||
KeyProperties keyProperties = context.get(KeyProperties.class);
|
||||
if (TextEncryptorConfigBootstrapper.keysConfigured(keyProperties)) {
|
||||
if (TextEncryptorConfigBootstrapper.RSA_IS_PRESENT) {
|
||||
if (TextEncryptorConfigBootstrapper.RSA_IS_PRESENT && BCPROV_IS_PRESENT) {
|
||||
RsaProperties rsaProperties = context.get(RsaProperties.class);
|
||||
return createTextEncryptor(keyProperties, rsaProperties);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.springframework.cloud.context.encrypt;
|
||||
|
||||
import org.springframework.security.crypto.encrypt.Encryptors;
|
||||
import org.springframework.security.crypto.encrypt.RsaSecretEncryptor;
|
||||
import org.springframework.security.crypto.encrypt.TextEncryptor;
|
||||
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.security.crypto.encrypt.RsaAlgorithm;
|
||||
import org.springframework.security.crypto.encrypt.TextEncryptor;
|
||||
import org.springframework.security.rsa.crypto.RsaAlgorithm;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
|
||||
import org.springframework.security.crypto.encrypt.RsaSecretEncryptor;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Ryan Baxter
|
||||
*/
|
||||
@ClassPathExclusions({ "spring-security-rsa*.jar" })
|
||||
@ClassPathExclusions({ "bcprov-jdk*.jar" })
|
||||
public class RsaDisabledTests {
|
||||
|
||||
private ConfigurableApplicationContext context;
|
||||
@@ -54,7 +54,7 @@ public class RsaDisabledTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadBalancedRetryFactoryBean() throws Exception {
|
||||
public void testNoRsaProperites() throws Exception {
|
||||
Map<String, RsaProperties> properties = this.context.getBeansOfType(RsaProperties.class);
|
||||
then(properties.values()).hasSize(0);
|
||||
}
|
||||
|
||||
@@ -30,15 +30,8 @@
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-rsa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<!-- Only needed at compile time -->
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user