@Test public void testCheckPermissionsWithResourceObjectWithFieldAnnotationOnNonStringField() { when(commonPermissionCheckingUtils.getParameter(any(), any(), any(), any())).thenReturn(new ResourceObjectWithNonStringAnnotation()); thrown.expect(AccessDeniedException.class); thrown.expectMessage("Annotated field within resource object is not string, thus access is denied!"); underTest.checkPermissions(getAnnotation(false), USER_CRN, null, null, 0L); verify(commonPermissionCheckingUtils, times(0)).proceed(any(), any(), anyLong()); verify(commonPermissionCheckingUtils).getParameter(any(), any(), eq(ResourceObject.class), eq(Object.class)); verify(commonPermissionCheckingUtils, times(0)).checkPermissionForUser(any(), anyString()); verify(commonPermissionCheckingUtils, times(0)).checkPermissionForUserOnResource(any(), anyString(), anyString()); verify(resourceBasedCrnProvider, times(0)).getResourceCrnByResourceName(anyString()); verify(resourceBasedCrnProvider, times(0)).getResourceCrnListByResourceNameList(any()); }
@Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByResourceObject methodAnnotation = (CheckPermissionByResourceObject) rawMethodAnnotation; Object resourceObject = getCommonPermissionCheckingUtils().getParameter(proceedingJoinPoint, methodSignature, ResourceObject.class, Object.class); checkPermissionOnResourceObjectFields(userCrn, resourceObject, methodAnnotation.deepSearchNeeded()); }
ResourceObjectPermissionChecker extends ResourcePermissionChecker<CheckPermissionByResourceObject> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByResourceObject methodAnnotation = (CheckPermissionByResourceObject) rawMethodAnnotation; Object resourceObject = getCommonPermissionCheckingUtils().getParameter(proceedingJoinPoint, methodSignature, ResourceObject.class, Object.class); checkPermissionOnResourceObjectFields(userCrn, resourceObject, methodAnnotation.deepSearchNeeded()); } }
ResourceObjectPermissionChecker extends ResourcePermissionChecker<CheckPermissionByResourceObject> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByResourceObject methodAnnotation = (CheckPermissionByResourceObject) rawMethodAnnotation; Object resourceObject = getCommonPermissionCheckingUtils().getParameter(proceedingJoinPoint, methodSignature, ResourceObject.class, Object.class); checkPermissionOnResourceObjectFields(userCrn, resourceObject, methodAnnotation.deepSearchNeeded()); }  }
ResourceObjectPermissionChecker extends ResourcePermissionChecker<CheckPermissionByResourceObject> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByResourceObject methodAnnotation = (CheckPermissionByResourceObject) rawMethodAnnotation; Object resourceObject = getCommonPermissionCheckingUtils().getParameter(proceedingJoinPoint, methodSignature, ResourceObject.class, Object.class); checkPermissionOnResourceObjectFields(userCrn, resourceObject, methodAnnotation.deepSearchNeeded()); }  @Override void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint,
            MethodSignature methodSignature, long startTime); @Override Class<CheckPermissionByResourceObject> supportedAnnotation(); }
ResourceObjectPermissionChecker extends ResourcePermissionChecker<CheckPermissionByResourceObject> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByResourceObject methodAnnotation = (CheckPermissionByResourceObject) rawMethodAnnotation; Object resourceObject = getCommonPermissionCheckingUtils().getParameter(proceedingJoinPoint, methodSignature, ResourceObject.class, Object.class); checkPermissionOnResourceObjectFields(userCrn, resourceObject, methodAnnotation.deepSearchNeeded()); }  @Override void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint,
            MethodSignature methodSignature, long startTime); @Override Class<CheckPermissionByResourceObject> supportedAnnotation();  }