@Test public void testEmptyFingerPrint() throws Exception { final UserGroupProvider userGroupProvider = mock(UserGroupProvider.class); final AccessPolicyProvider accessPolicyProvider = mock(AccessPolicyProvider.class); when(accessPolicyProvider.getUserGroupProvider()).thenReturn(userGroupProvider); final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider); Assert.assertEquals(EMPTY_FINGERPRINT, managedAuthorizer.getFingerprint()); }
@Override public String getFingerprint() throws AuthorizationAccessException { XMLStreamWriter writer = null; final StringWriter out = new StringWriter(); try { writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement("managedAuthorizations"); writer.writeStartElement(ACCESS_POLICY_PROVIDER_ELEMENT); if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { writer.writeCharacters(((ConfigurableAccessPolicyProvider) accessPolicyProvider).getFingerprint()); } writer.writeEndElement(); writer.writeStartElement(USER_GROUP_PROVIDER_ELEMENT); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { writer.writeCharacters(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint()); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } finally { if (writer != null) { try { writer.close(); } catch (XMLStreamException e) { } } } return out.toString(); }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { XMLStreamWriter writer = null; final StringWriter out = new StringWriter(); try { writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement("managedAuthorizations"); writer.writeStartElement(ACCESS_POLICY_PROVIDER_ELEMENT); if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { writer.writeCharacters(((ConfigurableAccessPolicyProvider) accessPolicyProvider).getFingerprint()); } writer.writeEndElement(); writer.writeStartElement(USER_GROUP_PROVIDER_ELEMENT); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { writer.writeCharacters(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint()); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } finally { if (writer != null) { try { writer.close(); } catch (XMLStreamException e) { } } } return out.toString(); } }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { XMLStreamWriter writer = null; final StringWriter out = new StringWriter(); try { writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement("managedAuthorizations"); writer.writeStartElement(ACCESS_POLICY_PROVIDER_ELEMENT); if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { writer.writeCharacters(((ConfigurableAccessPolicyProvider) accessPolicyProvider).getFingerprint()); } writer.writeEndElement(); writer.writeStartElement(USER_GROUP_PROVIDER_ELEMENT); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { writer.writeCharacters(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint()); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } finally { if (writer != null) { try { writer.close(); } catch (XMLStreamException e) { } } } return out.toString(); }  }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { XMLStreamWriter writer = null; final StringWriter out = new StringWriter(); try { writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement("managedAuthorizations"); writer.writeStartElement(ACCESS_POLICY_PROVIDER_ELEMENT); if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { writer.writeCharacters(((ConfigurableAccessPolicyProvider) accessPolicyProvider).getFingerprint()); } writer.writeEndElement(); writer.writeStartElement(USER_GROUP_PROVIDER_ELEMENT); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { writer.writeCharacters(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint()); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } finally { if (writer != null) { try { writer.close(); } catch (XMLStreamException e) { } } } return out.toString(); }  @Override void initialize(AuthorizerInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override AuthorizationResult authorize(AuthorizationRequest request); boolean isSecurityUserAutoGenerateEnabled(); @Override String getFingerprint(); @Override void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override AccessPolicyProvider getAccessPolicyProvider(); @Override void preDestruction(); }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public String getFingerprint() throws AuthorizationAccessException { XMLStreamWriter writer = null; final StringWriter out = new StringWriter(); try { writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement("managedAuthorizations"); writer.writeStartElement(ACCESS_POLICY_PROVIDER_ELEMENT); if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { writer.writeCharacters(((ConfigurableAccessPolicyProvider) accessPolicyProvider).getFingerprint()); } writer.writeEndElement(); writer.writeStartElement(USER_GROUP_PROVIDER_ELEMENT); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { writer.writeCharacters(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint()); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } finally { if (writer != null) { try { writer.close(); } catch (XMLStreamException e) { } } } return out.toString(); }  @Override void initialize(AuthorizerInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override AuthorizationResult authorize(AuthorizationRequest request); boolean isSecurityUserAutoGenerateEnabled(); @Override String getFingerprint(); @Override void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override AccessPolicyProvider getAccessPolicyProvider(); @Override void preDestruction();  }