Skip to content

Instantly share code, notes, and snippets.

@techforum-repo
Created November 17, 2020 23:46
Show Gist options
  • Save techforum-repo/801df22fb32a1063906c2f30757dec18 to your computer and use it in GitHub Desktop.
Save techforum-repo/801df22fb32a1063906c2f30757dec18 to your computer and use it in GitHub Desktop.
package com.example;
import java.io.ObjectInputFilter;
public class CustomClassFilter implements ObjectInputFilter{
public Status checkInput(FilterInfo filterInfo) {
Class<?> clazz = filterInfo.serialClass();
if (clazz != null) {
return !(clazz.getName().equals("com.example.Employee")) ? Status.ALLOWED : Status.REJECTED; //clazz.getPackage().equals("com.example")
}
return Status.UNDECIDED;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment