RestrictedMethodAuthorizer implements MethodInvocationAuthorizer { public boolean isPermanentlyForbiddenMethod(Method method, @SuppressWarnings("unused") Object target) { return forbiddenMethods.contains(method.getName()); } RestrictedMethodAuthorizer(Cache cache); boolean isAllowedGeodeMethod(Method method, Object target); boolean isPermanentlyForbiddenMethod(Method method,
      @SuppressWarnings("unused") Object target); @Override boolean authorize(Method method, Object target); static final String UNAUTHORIZED_STRING; }
@Test public void isPermanentlyForbiddenMethodShouldReturnTrueForNonSafeMethods() throws Exception { TestBean testBean = new TestBean(); List<Method> dangerousMethods = new ArrayList<>(); dangerousMethods.add(TestBean.class.getMethod("getClass")); dangerousMethods.add(TestBean.class.getMethod("readResolve")); dangerousMethods.add(TestBean.class.getMethod("readObjectNoData")); dangerousMethods.add(TestBean.class.getMethod("readObject", ObjectInputStream.class)); dangerousMethods.add(TestBean.class.getMethod("writeReplace")); dangerousMethods.add(TestBean.class.getMethod("writeObject", ObjectOutputStream.class)); dangerousMethods.forEach( method -> assertThat(methodAuthorizer.isPermanentlyForbiddenMethod(method, testBean)) .isTrue()); }