PermissionsAuthorizer implements Authorizer { @Override public void authorize(VContext ctx, Call call) throws VException { nativeAuthorize(nativeRef, ctx, call); } private  PermissionsAuthorizer(long nativeRef); static PermissionsAuthorizer create(Permissions perms, Type tagType); @Override void authorize(VContext ctx, Call call);  }
@Test public void testAuthorize() throws VException { Call call = VSecurity.newCall(new CallParams() .withLocalPrincipal(SERVER_PRINCIPAL) .withLocalBlessings(SERVER_BLESSINGS) .withRemoteBlessings(clientBlessings) .withMethod(methodName) .withMethodTags(methodTags)); try { AUTHORIZER.authorize(CONTEXT, call); if (!shouldAccept) { fail(String.format( "Access granted for method %s to %s", methodName, clientBlessings)); } } catch (VException e) { if (shouldAccept) { throw e; } } }
@Test public void testAuthorize() { Call call = VSecurity.newCall(new CallParams() .withLocalPrincipal(SERVER_PRINCIPAL) .withLocalBlessings(SERVER_BLESSINGS) .withRemoteBlessings(clientBlessings) .withMethod(methodName) .withMethodTags(methodTags)); try { AUTHORIZER.authorize(CONTEXT, call); if (!shouldAccept) { fail(String.format( "Access granted for method %s to %s", methodName, clientBlessings)); } } catch (VException e) { if (shouldAccept) { fail(String.format( "Access denied for method %s to %s", methodName, clientBlessings)); } } }