improve wall filter, add allowDoPrivileged

This commit is contained in:
wenshao
2012-12-10 18:16:18 +08:00
parent 2abc2d207e
commit b4ba5d6a3f
3 changed files with 16 additions and 2 deletions
@@ -21,6 +21,7 @@ import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.WallUtils;
@@ -31,10 +32,13 @@ public class DoPrivilegedTest extends TestCase {
}
public void test_1() throws Exception {
final WallConfig config = new WallConfig();
config.setAllowDoPrivileged(true);
WallProvider.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
Assert.assertTrue(WallUtils.isValidateMySql("select @@version_compile_os"));
Assert.assertTrue(WallUtils.isValidateMySql("select @@version_compile_os", config));
return null;
}
});