DATAGEODE-190 - Polish.
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException;
|
||||
@@ -28,6 +27,7 @@ import java.lang.annotation.Target;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.geode.security.SecurableCommunicationChannels;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -37,6 +37,7 @@ import org.springframework.util.Assert;
|
||||
* to configure and enable Pivotal GemFire/Apache Geode's TCP/IP Socket SSL.
|
||||
*
|
||||
* @author John Blum
|
||||
* @author Srikanth Manvi
|
||||
* @see java.lang.annotation.Annotation
|
||||
* @see org.apache.geode.security.SecurableCommunicationChannels
|
||||
* @see org.springframework.context.annotation.Import
|
||||
@@ -102,6 +103,18 @@ public @interface EnableSsl {
|
||||
*/
|
||||
String defaultCertificateAlias() default "";
|
||||
|
||||
/**
|
||||
* If {@literal true} then causes clients (or Apache Geode servers in cause of P2P) to validate the server's
|
||||
* hostname using the server`s certificate. Set to {@literal true} if {@literal useSSLDefaultDefaultContext}
|
||||
* is {@literal true}.
|
||||
*
|
||||
* Defaults to {@literal false}.
|
||||
*
|
||||
* Use the {@literal spring.data.gemfire.security.ssl.enable-endpoint-identification}
|
||||
* in {@literal application.properties}.
|
||||
*/
|
||||
boolean enableEndpointIdentification() default false;
|
||||
|
||||
/**
|
||||
* Pathname to the {@literal Keystore} used for SSL communications.
|
||||
*
|
||||
@@ -190,6 +203,17 @@ public @interface EnableSsl {
|
||||
*/
|
||||
String truststoreType() default "JKS";
|
||||
|
||||
/**
|
||||
* If {@literal true} then this will enable the use of default SSL context
|
||||
* and sets {@literal ssl-endpoint-identification-enabled} to {@literal true}.
|
||||
*
|
||||
* Defaults to {@literal false}.
|
||||
*
|
||||
* Use the {@literal spring.data.gemfire.security.ssl.use-default-context}
|
||||
* in {@literal application.properties}.
|
||||
*/
|
||||
boolean useDefaultContext() default false;
|
||||
|
||||
/**
|
||||
* If {@literal true} then requires two-way authentication for web component.
|
||||
*
|
||||
@@ -200,29 +224,6 @@ public @interface EnableSsl {
|
||||
*/
|
||||
boolean webRequireAuthentication() default false;
|
||||
|
||||
/**
|
||||
* If {@literal true} then allows the use of default SSL context and sets
|
||||
* ssl-endpoint-identification-enabled to true.
|
||||
*
|
||||
* Defaults to {@literal false}.
|
||||
*
|
||||
* Use the {@literal spring.data.gemfire.security.ssl.use-default-context}
|
||||
* in {@literal application.properties}.
|
||||
*/
|
||||
boolean sslUseDefaultContext() default false;
|
||||
|
||||
/**
|
||||
* If {@literal true} clients (GemFire servers in cause of p2p) to validate server's
|
||||
* hostname using server`s certificate.
|
||||
*
|
||||
* Defaults to {@literal false}. Set to {@literal true} if
|
||||
* {@literal useSSLDefaultDefaultContext} is true.
|
||||
*
|
||||
* Use the {@literal spring.data.gemfire.security.ssl.endpoint-identification-enabled}
|
||||
* in {@literal application.properties}.
|
||||
*/
|
||||
boolean sslEndpointIdentificationEnabled() default false;
|
||||
|
||||
enum Component {
|
||||
|
||||
ALL(SecurableCommunicationChannels.ALL),
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
@@ -38,6 +37,7 @@ import org.springframework.util.StringUtils;
|
||||
* additional configuration using Pivotal GemFire/Apache Geode {@link Properties} to configure SSL.
|
||||
*
|
||||
* @author John Blum
|
||||
* @author Srikanth Manvi
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableSsl
|
||||
* @see org.springframework.data.gemfire.config.annotation.support.EmbeddedServiceConfigurationSupport
|
||||
* @since 1.9.0
|
||||
@@ -69,48 +69,57 @@ public class SslConfiguration extends EmbeddedServiceConfigurationSupport {
|
||||
.map(EnableSsl.Component::toString)
|
||||
.collect(Collectors.toSet())))
|
||||
|
||||
.setProperty("ssl-ciphers", resolveProperty(sslProperty("ciphers"),
|
||||
StringUtils.arrayToCommaDelimitedString(annotationAttributes.getStringArray("ciphers"))))
|
||||
.setProperty("ssl-ciphers",
|
||||
resolveProperty(sslProperty("ciphers"),
|
||||
StringUtils.arrayToCommaDelimitedString(annotationAttributes.getStringArray("ciphers"))))
|
||||
|
||||
.setPropertyIfNotDefault("ssl-default-alias",
|
||||
resolveProperty(sslProperty("certificate.alias.default"),
|
||||
annotationAttributes.getString("defaultCertificateAlias")), "")
|
||||
|
||||
.setProperty("ssl-keystore", resolveProperty(sslProperty("keystore"),
|
||||
annotationAttributes.getString("keystore")))
|
||||
.setProperty("ssl-endpoint-identification-enabled",
|
||||
resolveProperty(sslProperty("enable-endpoint-identification"),
|
||||
annotationAttributes.getBoolean("enableEndpointIdentification")))
|
||||
|
||||
.setProperty("ssl-keystore-password", resolveProperty(sslProperty("keystore.password"),
|
||||
annotationAttributes.getString("keystorePassword")))
|
||||
.setProperty("ssl-keystore",
|
||||
resolveProperty(sslProperty("keystore"),
|
||||
annotationAttributes.getString("keystore")))
|
||||
|
||||
.setProperty("ssl-keystore-type", resolveProperty(sslProperty("keystore.type"),
|
||||
annotationAttributes.getString("keystoreType")))
|
||||
.setProperty("ssl-keystore-password",
|
||||
resolveProperty(sslProperty("keystore.password"),
|
||||
annotationAttributes.getString("keystorePassword")))
|
||||
|
||||
.setProperty("ssl-protocols", resolveProperty(sslProperty("protocols"),
|
||||
StringUtils.arrayToCommaDelimitedString(annotationAttributes.getStringArray("protocols"))))
|
||||
.setProperty("ssl-keystore-type",
|
||||
resolveProperty(sslProperty("keystore.type"),
|
||||
annotationAttributes.getString("keystoreType")))
|
||||
|
||||
.setProperty("ssl-protocols",
|
||||
resolveProperty(sslProperty("protocols"),
|
||||
StringUtils.arrayToCommaDelimitedString(annotationAttributes.getStringArray("protocols"))))
|
||||
|
||||
.setProperty("ssl-require-authentication",
|
||||
resolveProperty(sslProperty("require-authentication"),
|
||||
annotationAttributes.getBoolean("requireAuthentication")))
|
||||
|
||||
.setProperty("ssl-truststore", resolveProperty(sslProperty("truststore"),
|
||||
annotationAttributes.getString("truststore")))
|
||||
.setProperty("ssl-truststore",
|
||||
resolveProperty(sslProperty("truststore"),
|
||||
annotationAttributes.getString("truststore")))
|
||||
|
||||
.setProperty("ssl-truststore-password", resolveProperty(sslProperty("truststore.password"),
|
||||
annotationAttributes.getString("truststorePassword")))
|
||||
.setProperty("ssl-truststore-password",
|
||||
resolveProperty(sslProperty("truststore.password"),
|
||||
annotationAttributes.getString("truststorePassword")))
|
||||
|
||||
.setProperty("ssl-truststore-type", resolveProperty(sslProperty("truststore.type"),
|
||||
annotationAttributes.getString("truststoreType")))
|
||||
.setProperty("ssl-truststore-type",
|
||||
resolveProperty(sslProperty("truststore.type"),
|
||||
annotationAttributes.getString("truststoreType")))
|
||||
|
||||
.setProperty("ssl-use-default-context",
|
||||
resolveProperty(sslProperty("use-default-context"),
|
||||
annotationAttributes.getBoolean("useDefaultContext")))
|
||||
|
||||
.setProperty("ssl-web-require-authentication",
|
||||
resolveProperty(sslProperty("web-require-authentication"),
|
||||
annotationAttributes.getBoolean("webRequireAuthentication")))
|
||||
|
||||
.setProperty("ssl-use-default-context", resolveProperty(sslProperty("use-default-context"),
|
||||
annotationAttributes.getBoolean("sslUseDefaultContext")))
|
||||
|
||||
.setProperty("ssl-endpoint-identification-enabled", resolveProperty(sslProperty("endpoint-identification-enabled"),
|
||||
annotationAttributes.getBoolean("sslEndpointIdentificationEnabled")));
|
||||
|
||||
annotationAttributes.getBoolean("webRequireAuthentication")));
|
||||
|
||||
configureComponentCertificateAliases(annotationAttributes, gemfireProperties);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user