@Test public void testNonConfigurableFingerPrint() throws Exception { final UserGroupProvider userGroupProvider = mock(UserGroupProvider.class); final ManagedRangerAuthorizer managedRangerAuthorizer = getStandardManagedAuthorizer(userGroupProvider); Assert.assertEquals(EMPTY_FINGERPRINT, managedRangerAuthorizer.getFingerprint()); }
@Override public String getFingerprint() throws AuthorizationAccessException { final StringWriter out = new StringWriter(); try { final DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = documentBuilder.newDocument(); final Element managedRangerAuthorizationsElement = document.createElement("managedRangerAuthorizations"); document.appendChild(managedRangerAuthorizationsElement); final Element userGroupProviderElement = document.createElement(USER_GROUP_PROVIDER_ELEMENT); managedRangerAuthorizationsElement.appendChild(userGroupProviderElement); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { userGroupProviderElement.appendChild(document.createTextNode(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint())); } final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(out)); } catch (ParserConfigurationException | TransformerException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } return out.toString(); }
ManagedRangerAuthorizer extends RangerNiFiAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { final StringWriter out = new StringWriter(); try { final DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = documentBuilder.newDocument(); final Element managedRangerAuthorizationsElement = document.createElement("managedRangerAuthorizations"); document.appendChild(managedRangerAuthorizationsElement); final Element userGroupProviderElement = document.createElement(USER_GROUP_PROVIDER_ELEMENT); managedRangerAuthorizationsElement.appendChild(userGroupProviderElement); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { userGroupProviderElement.appendChild(document.createTextNode(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint())); } final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(out)); } catch (ParserConfigurationException | TransformerException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } return out.toString(); } }
ManagedRangerAuthorizer extends RangerNiFiAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { final StringWriter out = new StringWriter(); try { final DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = documentBuilder.newDocument(); final Element managedRangerAuthorizationsElement = document.createElement("managedRangerAuthorizations"); document.appendChild(managedRangerAuthorizationsElement); final Element userGroupProviderElement = document.createElement(USER_GROUP_PROVIDER_ELEMENT); managedRangerAuthorizationsElement.appendChild(userGroupProviderElement); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { userGroupProviderElement.appendChild(document.createTextNode(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint())); } final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(out)); } catch (ParserConfigurationException | TransformerException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } return out.toString(); }  }
ManagedRangerAuthorizer extends RangerNiFiAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { final StringWriter out = new StringWriter(); try { final DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = documentBuilder.newDocument(); final Element managedRangerAuthorizationsElement = document.createElement("managedRangerAuthorizations"); document.appendChild(managedRangerAuthorizationsElement); final Element userGroupProviderElement = document.createElement(USER_GROUP_PROVIDER_ELEMENT); managedRangerAuthorizationsElement.appendChild(userGroupProviderElement); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { userGroupProviderElement.appendChild(document.createTextNode(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint())); } final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(out)); } catch (ParserConfigurationException | TransformerException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } return out.toString(); }  @Override void initialize(AuthorizerInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override AccessPolicyProvider getAccessPolicyProvider(); @Override String getFingerprint(); @Override void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); }
ManagedRangerAuthorizer extends RangerNiFiAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { final StringWriter out = new StringWriter(); try { final DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = documentBuilder.newDocument(); final Element managedRangerAuthorizationsElement = document.createElement("managedRangerAuthorizations"); document.appendChild(managedRangerAuthorizationsElement); final Element userGroupProviderElement = document.createElement(USER_GROUP_PROVIDER_ELEMENT); managedRangerAuthorizationsElement.appendChild(userGroupProviderElement); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { userGroupProviderElement.appendChild(document.createTextNode(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint())); } final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(out)); } catch (ParserConfigurationException | TransformerException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } return out.toString(); }  @Override void initialize(AuthorizerInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override AccessPolicyProvider getAccessPolicyProvider(); @Override String getFingerprint(); @Override void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint);  }