@Test public void testGetAccessPolicy() throws Exception { writeFile(primaryAuthorizations, AUTHORIZATIONS); writeFile(primaryTenants, TENANTS); authorizer.onConfigured(configurationContext); assertEquals(2, authorizer.getAccessPolicies().size()); final AccessPolicy policy = authorizer.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(final String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }
FileAuthorizer extends AbstractPolicyBasedAuthorizer { @Override public AccessPolicy getAccessPolicy(final String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); } }
FileAuthorizer extends AbstractPolicyBasedAuthorizer { @Override public AccessPolicy getAccessPolicy(final String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }  }
FileAuthorizer extends AbstractPolicyBasedAuthorizer { @Override public AccessPolicy getAccessPolicy(final String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }  @Override void initialize(final AuthorizerInitializationContext initializationContext); @Override void doOnConfigured(final AuthorizerConfigurationContext configurationContext); @AuthorizerContext void setNiFiProperties(NiFiProperties properties); @Override void preDestruction(); @Override synchronized Group doAddGroup(Group group); @Override Group getGroup(String identifier); @Override synchronized Group doUpdateGroup(Group group); @Override synchronized Group deleteGroup(Group group); @Override Set<Group> getGroups(); @Override synchronized User doAddUser(final User user); @Override User getUser(final String identifier); @Override User getUserByIdentity(final String identity); @Override synchronized User doUpdateUser(final User user); @Override synchronized User deleteUser(final User user); @Override Set<User> getUsers(); @Override synchronized AccessPolicy doAddAccessPolicy(final AccessPolicy accessPolicy); @Override AccessPolicy getAccessPolicy(final String identifier); @Override synchronized AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy); @Override synchronized AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy); @Override Set<AccessPolicy> getAccessPolicies(); @Override UsersAndAccessPolicies getUsersAndAccessPolicies(); }
FileAuthorizer extends AbstractPolicyBasedAuthorizer { @Override public AccessPolicy getAccessPolicy(final String identifier) throws AuthorizationAccessException { if (identifier == null) { return null; } final AuthorizationsHolder holder = authorizationsHolder.get(); return holder.getPoliciesById().get(identifier); }  @Override void initialize(final AuthorizerInitializationContext initializationContext); @Override void doOnConfigured(final AuthorizerConfigurationContext configurationContext); @AuthorizerContext void setNiFiProperties(NiFiProperties properties); @Override void preDestruction(); @Override synchronized Group doAddGroup(Group group); @Override Group getGroup(String identifier); @Override synchronized Group doUpdateGroup(Group group); @Override synchronized Group deleteGroup(Group group); @Override Set<Group> getGroups(); @Override synchronized User doAddUser(final User user); @Override User getUser(final String identifier); @Override User getUserByIdentity(final String identity); @Override synchronized User doUpdateUser(final User user); @Override synchronized User deleteUser(final User user); @Override Set<User> getUsers(); @Override synchronized AccessPolicy doAddAccessPolicy(final AccessPolicy accessPolicy); @Override AccessPolicy getAccessPolicy(final String identifier); @Override synchronized AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy); @Override synchronized AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy); @Override Set<AccessPolicy> getAccessPolicies(); @Override UsersAndAccessPolicies getUsersAndAccessPolicies();  }