Adapt to API changes in Spring Data for Apache Geode (SDG).
This commit is contained in:
@@ -41,7 +41,6 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.EnableSecurity;
|
||||
import org.springframework.data.gemfire.config.annotation.support.AutoConfiguredAuthenticationInitializer;
|
||||
import org.springframework.geode.core.env.VcapPropertySource;
|
||||
import org.springframework.geode.core.env.support.CloudCacheService;
|
||||
import org.springframework.geode.core.env.support.User;
|
||||
@@ -112,11 +111,8 @@ public class ClientSecurityAutoConfiguration {
|
||||
|
||||
private static final String POOL_LOCATORS_PROPERTY = "spring.data.gemfire.pool.locators";
|
||||
|
||||
private static final String SECURITY_USERNAME_PROPERTY =
|
||||
AutoConfiguredAuthenticationInitializer.SDG_SECURITY_USERNAME_PROPERTY;
|
||||
|
||||
private static final String SECURITY_PASSWORD_PROPERTY =
|
||||
AutoConfiguredAuthenticationInitializer.SDG_SECURITY_PASSWORD_PROPERTY;
|
||||
private static final String SECURITY_USERNAME_PROPERTY = "spring.data.gemfire.security.username";
|
||||
private static final String SECURITY_PASSWORD_PROPERTY = "spring.data.gemfire.security.password";
|
||||
|
||||
private static final String SSL_USE_DEFAULT_CONTEXT_PROPERTY =
|
||||
"spring.data.gemfire.security.ssl.use-default-context";
|
||||
|
||||
@@ -17,6 +17,9 @@ package org.springframework.geode.config.annotation;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
@@ -46,9 +49,11 @@ public class SecurityManagerProxyConfiguration implements ApplicationListener<Co
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
|
||||
ApplicationContext applicationContext = event.getApplicationContext();
|
||||
|
||||
SecurityManagerProxy securityManagerProxy = SecurityManagerProxy.getInstance();
|
||||
|
||||
securityManagerProxy.setBeanFactory(event.getApplicationContext().getAutowireCapableBeanFactory());
|
||||
securityManagerProxy.init(new Properties());
|
||||
securityManagerProxy.setBeanFactory(applicationContext.getAutowireCapableBeanFactory());
|
||||
securityManagerProxy.initialize(applicationContext.getBean(Cache.class), new Properties());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +171,11 @@ public class SecurityManagerProxy extends LazyWiringDeclarableSupport
|
||||
INSTANCE.set(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Properties props) {
|
||||
super.init(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BeanFactory locateBeanFactory() {
|
||||
return this.beanFactory != null ? this.beanFactory : super.locateBeanFactory();
|
||||
|
||||
@@ -18,11 +18,13 @@ package org.springframework.geode.security.support;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
@@ -35,7 +37,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link SecurityManagerProxy}.
|
||||
* Integration Tests for {@link SecurityManagerProxy}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.geode.security.support;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -27,11 +26,12 @@ import static org.mockito.Mockito.when;
|
||||
import java.security.Principal;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.geode.security.ResourcePermission;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.security.ResourcePermission;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link SecurityManagerProxy}
|
||||
* Unit Tests for {@link SecurityManagerProxy}
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.security.Principal
|
||||
|
||||
Reference in New Issue
Block a user