use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class KeySetTest 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).keySetAuthorize(eq(REGION_NAME));
this.keySet.cmdExecute(this.message, this.serverConnection, 0);
verify(this.authzRequest).keySetAuthorize(eq(REGION_NAME));
ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClass(NotAuthorizedException.class);
verify(this.chunkedResponseMessage).addObjPart(argument.capture());
assertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.class);
verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class Put61Test 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).putAuthorize(eq(REGION_NAME), eq(KEY), eq(null), eq(true), eq(CALLBACK_ARG));
this.put61.cmdExecute(this.message, this.serverConnection, 0);
verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(null), eq(true), eq(CALLBACK_ARG));
ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClass(NotAuthorizedException.class);
verify(this.errorResponseMessage).addObjPart(argument.capture());
assertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.class);
verify(this.errorResponseMessage).send(this.serverConnection);
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class RegisterInterestList66Test method integratedSecurityShouldThrowIfNotAuthorized.
@Test
public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception {
when(this.securityService.isClientSecurityRequired()).thenReturn(true);
when(this.securityService.isIntegratedSecurity()).thenReturn(true);
doThrow(new NotAuthorizedException("")).when(this.securityService).authorizeRegionRead(eq(REGION_NAME));
this.registerInterestList66.cmdExecute(this.message, this.serverConnection, 0);
verify(this.securityService).authorizeRegionRead(eq(REGION_NAME));
verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class RegisterInterestList66Test 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).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
this.registerInterestList66.cmdExecute(this.message, this.serverConnection, 0);
verify(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClass(NotAuthorizedException.class);
verify(this.chunkedResponseMessage).addObjPart(argument.capture());
assertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.class);
verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}
use of org.apache.geode.security.NotAuthorizedException in project geode by apache.
the class RegisterInterestListTest 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).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
this.registerInterestList.cmdExecute(this.message, this.serverConnection, 0);
verify(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClass(NotAuthorizedException.class);
verify(this.chunkedResponseMessage).addObjPart(argument.capture());
assertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.class);
verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}
Aggregations