Search in sources :

Example 1 with AuthEnforceRewriter

use of co.cask.cdap.common.security.AuthEnforceRewriter in project cdap by caskdata.

the class AuthEnforceRewriterTest method rewrite.

private ClassDefinition rewrite(Class cls) throws Exception {
    AuthEnforceRewriter rewriter = new AuthEnforceRewriter();
    URL url = cls.getClassLoader().getResource(cls.getName().replace('.', '/') + ".class");
    Assert.assertNotNull(url);
    try (InputStream is = url.openStream()) {
        return new ClassDefinition(rewriter.rewriteClass(cls.getName(), is), Type.getInternalName(cls));
    }
}
Also used : AuthEnforceRewriter(co.cask.cdap.common.security.AuthEnforceRewriter) InputStream(java.io.InputStream) ClassDefinition(co.cask.cdap.internal.asm.ClassDefinition) URL(java.net.URL)

Aggregations

AuthEnforceRewriter (co.cask.cdap.common.security.AuthEnforceRewriter)1 ClassDefinition (co.cask.cdap.internal.asm.ClassDefinition)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1