use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class ExecuteFunctionTest method withIntegratedSecurityShouldThrowIfNotAuthorized.
@Test
public void withIntegratedSecurityShouldThrowIfNotAuthorized() throws Exception {
when(this.securityService.isClientSecurityRequired()).thenReturn(true);
when(this.securityService.isIntegratedSecurity()).thenReturn(true);
doThrow(new NotAuthorizedException("")).when(this.securityService).authorizeDataWrite();
this.executeFunction.cmdExecute(this.message, this.serverConnection, 0);
verify(this.securityService).authorizeDataWrite();
verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class Get70Test method oldSecurityShouldFailIfNotAuthorized.
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
when(this.securityService.isClientSecurityRequired()).thenReturn(true);
when(this.securityService.isIntegratedSecurity()).thenReturn(false);
doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG));
this.get70.cmdExecute(this.message, this.serverConnection, 0);
verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG));
verify(this.errorResponseMessage).send(eq(this.serverConnection));
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class GetAll70Test method oldSecurityShouldFailIfNotAuthorized.
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
when(this.securityService.isClientSecurityRequired()).thenReturn(true);
when(this.securityService.isIntegratedSecurity()).thenReturn(false);
for (Object key : KEYS) {
doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
}
this.getAll70.cmdExecute(this.message, this.serverConnection, 0);
ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClass(ObjectPartList.class);
verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
assertThat(argument.getValue().getObjects()).hasSize(KEYS.length);
for (Object o : argument.getValue().getObjects()) {
assertThat(o).isExactlyInstanceOf(NotAuthorizedException.class);
}
for (Object key : KEYS) {
verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
}
verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class Put61Test method integratedSecurityShouldFailIfNotAuthorized.
@Test
public void integratedSecurityShouldFailIfNotAuthorized() throws Exception {
when(this.securityService.isClientSecurityRequired()).thenReturn(true);
when(this.securityService.isIntegratedSecurity()).thenReturn(true);
doThrow(new NotAuthorizedException("")).when(this.securityService).authorizeRegionWrite(eq(REGION_NAME), eq(KEY));
this.put61.cmdExecute(this.message, this.serverConnection, 0);
verify(this.securityService).authorizeRegionWrite(eq(REGION_NAME), eq(KEY));
verify(this.errorResponseMessage).send(this.serverConnection);
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class Put65Test method integratedSecurityShouldFailIfNotAuthorized.
@Test
public void integratedSecurityShouldFailIfNotAuthorized() throws Exception {
when(this.securityService.isClientSecurityRequired()).thenReturn(true);
when(this.securityService.isIntegratedSecurity()).thenReturn(true);
doThrow(new NotAuthorizedException("")).when(this.securityService).authorizeRegionWrite(eq(REGION_NAME), eq(KEY));
this.put65.cmdExecute(this.message, this.serverConnection, 0);
verify(this.securityService).authorizeRegionWrite(eq(REGION_NAME), eq(KEY));
verify(this.errorResponseMessage).send(this.serverConnection);
}
Aggregations