@Test public void testCheckAuthorizationNullUser() { final AuthorizationResult result = testDataAuthorizable.checkAuthorization(testAuthorizer, RequestAction.READ, null, null); assertEquals(Result.Denied, result.getResult()); }
@Override public AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) { if (user == null) { return AuthorizationResult.denied("Unknown user."); } AuthorizationResult result = null; NiFiUser chainedUser = user; do { try { result = Authorizable.super.checkAuthorization(authorizer, action, chainedUser, resourceContext); if (!Result.Approved.equals(result.getResult())) { return result; } chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { result = AuthorizationResult.denied("Unknown source component."); } } while (chainedUser != null); if (result == null) { result = AuthorizationResult.denied(); } return result; }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) { if (user == null) { return AuthorizationResult.denied("Unknown user."); } AuthorizationResult result = null; NiFiUser chainedUser = user; do { try { result = Authorizable.super.checkAuthorization(authorizer, action, chainedUser, resourceContext); if (!Result.Approved.equals(result.getResult())) { return result; } chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { result = AuthorizationResult.denied("Unknown source component."); } } while (chainedUser != null); if (result == null) { result = AuthorizationResult.denied(); } return result; } }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) { if (user == null) { return AuthorizationResult.denied("Unknown user."); } AuthorizationResult result = null; NiFiUser chainedUser = user; do { try { result = Authorizable.super.checkAuthorization(authorizer, action, chainedUser, resourceContext); if (!Result.Approved.equals(result.getResult())) { return result; } chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { result = AuthorizationResult.denied("Unknown source component."); } } while (chainedUser != null); if (result == null) { result = AuthorizationResult.denied(); } return result; } DataAuthorizable(final Authorizable authorizable); }
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) { if (user == null) { return AuthorizationResult.denied("Unknown user."); } AuthorizationResult result = null; NiFiUser chainedUser = user; do { try { result = Authorizable.super.checkAuthorization(authorizer, action, chainedUser, resourceContext); if (!Result.Approved.equals(result.getResult())) { return result; } chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { result = AuthorizationResult.denied("Unknown source component."); } } while (chainedUser != null); if (result == null) { result = AuthorizationResult.denied(); } return result; } 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 AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) { if (user == null) { return AuthorizationResult.denied("Unknown user."); } AuthorizationResult result = null; NiFiUser chainedUser = user; do { try { result = Authorizable.super.checkAuthorization(authorizer, action, chainedUser, resourceContext); if (!Result.Approved.equals(result.getResult())) { return result; } chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { result = AuthorizationResult.denied("Unknown source component."); } } while (chainedUser != null); if (result == null) { result = AuthorizationResult.denied(); } return result; } 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);  }