@Test public void testGetAccessPolicy() throws Exception { writeFile(primaryAuthorizations, AUTHORIZATIONS); writeFile(primaryTenants, TENANTS); userGroupProvider.onConfigured(configurationContext); accessPolicyProvider.onConfigured(configurationContext); assertEquals(2, accessPolicyProvider.getAccessPolicies().size()); final AccessPolicy policy = accessPolicyProvider.getAccessPolicy("policy-1"); assertNotNull(policy); assertEquals("policy-1", policy.getIdentifier()); assertEquals("/flow", policy.getResource()); assertEquals(RequestAction.READ, policy.getAction()); assertEquals(1, policy.getUsers().size()); assertTrue(policy.getUsers().contains("user-1")); assertEquals(2, policy.getGroups().size()); assertTrue(policy.getGroups().contains("group-1")); assertTrue(policy.getGroups().contains("group-2")); }
@Override public AccessPolicy getAccessPolicy(String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }
FileAccessPolicyProvider implements ConfigurableAccessPolicyProvider { @Override public AccessPolicy getAccessPolicy(String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); } }
FileAccessPolicyProvider implements ConfigurableAccessPolicyProvider { @Override public AccessPolicy getAccessPolicy(String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }  }
FileAccessPolicyProvider implements ConfigurableAccessPolicyProvider { @Override public AccessPolicy getAccessPolicy(String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }  @Override void initialize(AccessPolicyProviderInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override UserGroupProvider getUserGroupProvider(); @Override Set<AccessPolicy> getAccessPolicies(); @Override synchronized AccessPolicy addAccessPolicy(AccessPolicy accessPolicy); @Override AccessPolicy getAccessPolicy(String identifier); @Override AccessPolicy getAccessPolicy(String resourceIdentifier, RequestAction action); @Override synchronized AccessPolicy updateAccessPolicy(AccessPolicy accessPolicy); @Override synchronized AccessPolicy deleteAccessPolicy(AccessPolicy accessPolicy); @AuthorizerContext void setNiFiProperties(NiFiProperties properties); @Override synchronized void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override String getFingerprint(); @Override void preDestruction(); @Override void setUserDefaultAccesPilicy(User user); }
FileAccessPolicyProvider implements ConfigurableAccessPolicyProvider { @Override public AccessPolicy getAccessPolicy(String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }  @Override void initialize(AccessPolicyProviderInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override UserGroupProvider getUserGroupProvider(); @Override Set<AccessPolicy> getAccessPolicies(); @Override synchronized AccessPolicy addAccessPolicy(AccessPolicy accessPolicy); @Override AccessPolicy getAccessPolicy(String identifier); @Override AccessPolicy getAccessPolicy(String resourceIdentifier, RequestAction action); @Override synchronized AccessPolicy updateAccessPolicy(AccessPolicy accessPolicy); @Override synchronized AccessPolicy deleteAccessPolicy(AccessPolicy accessPolicy); @AuthorizerContext void setNiFiProperties(NiFiProperties properties); @Override synchronized void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override String getFingerprint(); @Override void preDestruction(); @Override void setUserDefaultAccesPilicy(User user);  }