@Test public void testCheckInheritNonEmptyFingerprint() throws Exception { final ConfigurableUserGroupProvider userGroupProvider = mock(ConfigurableUserGroupProvider.class); final ConfigurableAccessPolicyProvider accessPolicyProvider = mock(ConfigurableAccessPolicyProvider.class); when(accessPolicyProvider.getUserGroupProvider()).thenReturn(userGroupProvider); final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider); managedAuthorizer.checkInheritability(NON_EMPTY_FINGERPRINT); verify(userGroupProvider, times(1)).checkInheritability(TENANT_FINGERPRINT); verify(accessPolicyProvider, times(1)).checkInheritability(ACCESS_POLICY_FINGERPRINT); }
@Override public void checkInheritability(String proposedFingerprint) throws AuthorizationAccessException, UninheritableAuthorizationsException { final FingerprintHolder fingerprintHolder = parseFingerprint(proposedFingerprint); if (StringUtils.isNotBlank(fingerprintHolder.getPolicyFingerprint())) { if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { ((ConfigurableAccessPolicyProvider) accessPolicyProvider).checkInheritability(fingerprintHolder.getPolicyFingerprint()); } else { throw new UninheritableAuthorizationsException("Policy fingerprint is not blank and the configured AccessPolicyProvider does not support fingerprinting."); } } if (StringUtils.isNotBlank(fingerprintHolder.getUserGroupFingerprint())) { if (userGroupProvider instanceof ConfigurableUserGroupProvider) { ((ConfigurableUserGroupProvider) userGroupProvider).checkInheritability(fingerprintHolder.getUserGroupFingerprint()); } else { throw new UninheritableAuthorizationsException("User/Group fingerprint is not blank and the configured UserGroupProvider does not support fingerprinting."); } } }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public void checkInheritability(String proposedFingerprint) throws AuthorizationAccessException, UninheritableAuthorizationsException { final FingerprintHolder fingerprintHolder = parseFingerprint(proposedFingerprint); if (StringUtils.isNotBlank(fingerprintHolder.getPolicyFingerprint())) { if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { ((ConfigurableAccessPolicyProvider) accessPolicyProvider).checkInheritability(fingerprintHolder.getPolicyFingerprint()); } else { throw new UninheritableAuthorizationsException("Policy fingerprint is not blank and the configured AccessPolicyProvider does not support fingerprinting."); } } if (StringUtils.isNotBlank(fingerprintHolder.getUserGroupFingerprint())) { if (userGroupProvider instanceof ConfigurableUserGroupProvider) { ((ConfigurableUserGroupProvider) userGroupProvider).checkInheritability(fingerprintHolder.getUserGroupFingerprint()); } else { throw new UninheritableAuthorizationsException("User/Group fingerprint is not blank and the configured UserGroupProvider does not support fingerprinting."); } } } }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public void checkInheritability(String proposedFingerprint) throws AuthorizationAccessException, UninheritableAuthorizationsException { final FingerprintHolder fingerprintHolder = parseFingerprint(proposedFingerprint); if (StringUtils.isNotBlank(fingerprintHolder.getPolicyFingerprint())) { if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { ((ConfigurableAccessPolicyProvider) accessPolicyProvider).checkInheritability(fingerprintHolder.getPolicyFingerprint()); } else { throw new UninheritableAuthorizationsException("Policy fingerprint is not blank and the configured AccessPolicyProvider does not support fingerprinting."); } } if (StringUtils.isNotBlank(fingerprintHolder.getUserGroupFingerprint())) { if (userGroupProvider instanceof ConfigurableUserGroupProvider) { ((ConfigurableUserGroupProvider) userGroupProvider).checkInheritability(fingerprintHolder.getUserGroupFingerprint()); } else { throw new UninheritableAuthorizationsException("User/Group fingerprint is not blank and the configured UserGroupProvider does not support fingerprinting."); } } }  }
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public void checkInheritability(String proposedFingerprint) throws AuthorizationAccessException, UninheritableAuthorizationsException { final FingerprintHolder fingerprintHolder = parseFingerprint(proposedFingerprint); if (StringUtils.isNotBlank(fingerprintHolder.getPolicyFingerprint())) { if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { ((ConfigurableAccessPolicyProvider) accessPolicyProvider).checkInheritability(fingerprintHolder.getPolicyFingerprint()); } else { throw new UninheritableAuthorizationsException("Policy fingerprint is not blank and the configured AccessPolicyProvider does not support fingerprinting."); } } if (StringUtils.isNotBlank(fingerprintHolder.getUserGroupFingerprint())) { if (userGroupProvider instanceof ConfigurableUserGroupProvider) { ((ConfigurableUserGroupProvider) userGroupProvider).checkInheritability(fingerprintHolder.getUserGroupFingerprint()); } else { throw new UninheritableAuthorizationsException("User/Group fingerprint is not blank and the configured UserGroupProvider does not support fingerprinting."); } } }  @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 void checkInheritability(String proposedFingerprint) throws AuthorizationAccessException, UninheritableAuthorizationsException { final FingerprintHolder fingerprintHolder = parseFingerprint(proposedFingerprint); if (StringUtils.isNotBlank(fingerprintHolder.getPolicyFingerprint())) { if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { ((ConfigurableAccessPolicyProvider) accessPolicyProvider).checkInheritability(fingerprintHolder.getPolicyFingerprint()); } else { throw new UninheritableAuthorizationsException("Policy fingerprint is not blank and the configured AccessPolicyProvider does not support fingerprinting."); } } if (StringUtils.isNotBlank(fingerprintHolder.getUserGroupFingerprint())) { if (userGroupProvider instanceof ConfigurableUserGroupProvider) { ((ConfigurableUserGroupProvider) userGroupProvider).checkInheritability(fingerprintHolder.getUserGroupFingerprint()); } else { throw new UninheritableAuthorizationsException("User/Group fingerprint is not blank and the configured UserGroupProvider does not support fingerprinting."); } } }  @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();  }