DATAGEODE-55 - Adapt to Apache Geode Integrated Security Framework changes.
This commit is contained in:
@@ -141,6 +141,7 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
@Test
|
||||
@DirtiesContext
|
||||
public void authorizedUser() {
|
||||
|
||||
assertThat(echo.get("one")).isEqualTo("one");
|
||||
assertThat(echo.put("two", "four")).isNull();
|
||||
assertThat(echo.get("two")).isEqualTo("four");
|
||||
@@ -148,11 +149,13 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
|
||||
@Test(expected = NotAuthorizedException.class)
|
||||
public void unauthorizedUser() {
|
||||
|
||||
try {
|
||||
assertThat(echo.get("one")).isEqualTo("one");
|
||||
echo.put("two", "four");
|
||||
}
|
||||
catch (ServerOperationException expected) {
|
||||
|
||||
assertThat(expected).hasMessageContaining("analyst not authorized for DATA:WRITE:Echo:two");
|
||||
assertThat(expected).hasCauseInstanceOf(NotAuthorizedException.class);
|
||||
|
||||
@@ -233,9 +236,9 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
@CacheServerApplication(name = "GeodeSecurityIntegrationTestsServer", logLevel = TEST_GEMFIRE_LOG_LEVEL,
|
||||
port = CACHE_SERVER_PORT)
|
||||
@Import({
|
||||
ApacheShiroIniGeodeSecurityIntegrationTests.ApacheShiroIniConfiguration.class,
|
||||
ApacheShiroRealmGeodeSecurityIntegrationTests.ApacheShiroRealmConfiguration.class,
|
||||
ApacheGeodeSecurityManagerGeodeSecurityIntegrationTests.ApacheGeodeSecurityManagerConfiguration.class
|
||||
ApacheShiroIniSecurityIntegrationTests.ApacheShiroIniConfiguration.class,
|
||||
ApacheShiroRealmSecurityIntegrationTests.ApacheShiroRealmConfiguration.class,
|
||||
ApacheGeodeSecurityManagerSecurityIntegrationTests.ApacheGeodeSecurityManagerConfiguration.class
|
||||
})
|
||||
@Profile("apache-geode-server")
|
||||
public static class GeodeServerConfiguration {
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = AbstractGeodeSecurityIntegrationTests.GeodeClientConfiguration.class)
|
||||
@ActiveProfiles("apache-geode-client")
|
||||
public class ApacheGeodeSecurityManagerGeodeSecurityIntegrationTests extends AbstractGeodeSecurityIntegrationTests {
|
||||
public class ApacheGeodeSecurityManagerSecurityIntegrationTests extends AbstractGeodeSecurityIntegrationTests {
|
||||
|
||||
protected static final String GEODE_SECURITY_MANAGER_PROPERTY_CONFIGURATION_PROFILE =
|
||||
"geode-security-manager-property-configuration";
|
||||
@@ -59,7 +59,7 @@ public class ApacheGeodeSecurityManagerGeodeSecurityIntegrationTests extends Abs
|
||||
|
||||
@Configuration
|
||||
@EnableSecurity(securityManagerClassName =
|
||||
"org.springframework.data.gemfire.config.annotation.ApacheGeodeSecurityManagerGeodeSecurityIntegrationTests$TestGeodeSecurityManager")
|
||||
"org.springframework.data.gemfire.config.annotation.ApacheGeodeSecurityManagerSecurityIntegrationTests$TestGeodeSecurityManager")
|
||||
@Profile(GEODE_SECURITY_MANAGER_PROPERTY_CONFIGURATION_PROFILE)
|
||||
public static class ApacheGeodeSecurityManagerConfiguration {
|
||||
}
|
||||
@@ -37,7 +37,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = AbstractGeodeSecurityIntegrationTests.GeodeClientConfiguration.class)
|
||||
@ActiveProfiles("apache-geode-client")
|
||||
public class ApacheShiroIniGeodeSecurityIntegrationTests extends AbstractGeodeSecurityIntegrationTests {
|
||||
public class ApacheShiroIniSecurityIntegrationTests extends AbstractGeodeSecurityIntegrationTests {
|
||||
|
||||
protected static final String SHIRO_INI_CONFIGURATION_PROFILE = "shiro-ini-configuration";
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = AbstractGeodeSecurityIntegrationTests.GeodeClientConfiguration.class)
|
||||
@ActiveProfiles("apache-geode-client")
|
||||
public class ApacheShiroRealmGeodeSecurityIntegrationTests extends AbstractGeodeSecurityIntegrationTests {
|
||||
public class ApacheShiroRealmSecurityIntegrationTests extends AbstractGeodeSecurityIntegrationTests {
|
||||
|
||||
protected static final String SHIRO_REALM_CONFIGURATION_PROFILE = "shiro-realm-configuration";
|
||||
|
||||
@@ -58,9 +58,12 @@ public class ApacheShiroRealmGeodeSecurityIntegrationTests extends AbstractGeode
|
||||
|
||||
@Bean
|
||||
public PropertiesRealm shiroRealm() {
|
||||
|
||||
PropertiesRealm propertiesRealm = new PropertiesRealm();
|
||||
|
||||
propertiesRealm.setResourcePath("classpath:shiro.properties");
|
||||
propertiesRealm.setPermissionResolver(new GeodePermissionResolver());
|
||||
|
||||
return propertiesRealm;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user