@Test(expected = AccessDeniedException.class) public void testAuthorizeUnauthorizedUser() { final NiFiUser user = new StandardNiFiUser("unknown"); testDataAuthorizable.authorize(testAuthorizer, RequestAction.READ, user, null); }
@Override public void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) throws AccessDeniedException { if (user == null) { throw new AccessDeniedException("Unknown user."); } NiFiUser chainedUser = user; do { try { Authorizable.super.authorize(authorizer, action, chainedUser, resourceContext); chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { throw new AccessDeniedException("Unknown source component."); } } while (chainedUser != null); }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) throws AccessDeniedException { if (user == null) { throw new AccessDeniedException("Unknown user."); } NiFiUser chainedUser = user; do { try { Authorizable.super.authorize(authorizer, action, chainedUser, resourceContext); chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { throw new AccessDeniedException("Unknown source component."); } } while (chainedUser != null); } }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) throws AccessDeniedException { if (user == null) { throw new AccessDeniedException("Unknown user."); } NiFiUser chainedUser = user; do { try { Authorizable.super.authorize(authorizer, action, chainedUser, resourceContext); chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { throw new AccessDeniedException("Unknown source component."); } } while (chainedUser != null); } DataAuthorizable(final Authorizable authorizable); }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) throws AccessDeniedException { if (user == null) { throw new AccessDeniedException("Unknown user."); } NiFiUser chainedUser = user; do { try { Authorizable.super.authorize(authorizer, action, chainedUser, resourceContext); chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { throw new AccessDeniedException("Unknown source component."); } } while (chainedUser != null); } DataAuthorizable(final Authorizable authorizable); @Override Authorizable getBaseAuthorizable(); @Override Authorizable getParentAuthorizable(); @Override Resource getResource(); @Override AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext); @Override void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext); }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) throws AccessDeniedException { if (user == null) { throw new AccessDeniedException("Unknown user."); } NiFiUser chainedUser = user; do { try { Authorizable.super.authorize(authorizer, action, chainedUser, resourceContext); chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { throw new AccessDeniedException("Unknown source component."); } } while (chainedUser != null); } DataAuthorizable(final Authorizable authorizable); @Override Authorizable getBaseAuthorizable(); @Override Authorizable getParentAuthorizable(); @Override Resource getResource(); @Override AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext); @Override void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext);  }