@Test public void testMatchingRolesAllWithWildcardRole() { AccessControlRule accessControlRule = new AccessControlRule(); accessControlRule.setActionName("createTask"); accessControlRule.setObjectType("CASE_FILE"); accessControlRule.setObjectSubType("ORDER"); accessControlRule.setUserRolesAll(Arrays.asList("ROLE_ADMINISTRATOR", "ACM_ADMINISTRATOR_DEV@*")); GrantedAuthority grantedAuthority1 = new SimpleGrantedAuthority("ROLE_ADMINISTRATOR"); GrantedAuthority grantedAuthority2 = new SimpleGrantedAuthority("ROLE_ANALYST"); GrantedAuthority grantedAuthority3 = new SimpleGrantedAuthority("ROLE_TECHNICIAN"); GrantedAuthority grantedAuthority4 = new SimpleGrantedAuthority("ACM_ADMINISTRATOR_DEV@armedia.com"); Collection grantedAuthorities = Arrays.asList(grantedAuthority1, grantedAuthority2, grantedAuthority3, grantedAuthority4); EasyMock.expect(accessControlRulesMock.getAccessControlRuleList()).andReturn(Arrays.asList(accessControlRule)).anyTimes(); EasyMock.expect(accessControlRulesMock.getPropertiesMapping()).andReturn(propertiesMapping); EasyMock.expect(authenticationMock.getName()).andReturn("ann-acm").anyTimes(); EasyMock.expect(authenticationMock.getAuthorities()).andReturn(grantedAuthorities).anyTimes(); replayAll(); boolean granted = accessControlRuleChecker.isAccessGranted(authenticationMock, 1L, "CASE_FILE", "createTask", solrDocument); assertTrue(granted); verifyAll(); }
@Override public boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument) { return isAccessGranted(authentication, targetId, targetType, Arrays.asList(permission.split("\\|")), solrDocument); }
AccessControlRuleCheckerImpl implements AccessControlRuleChecker { @Override public boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument) { return isAccessGranted(authentication, targetId, targetType, Arrays.asList(permission.split("\\|")), solrDocument); } }
AccessControlRuleCheckerImpl implements AccessControlRuleChecker { @Override public boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument) { return isAccessGranted(authentication, targetId, targetType, Arrays.asList(permission.split("\\|")), solrDocument); }  }
AccessControlRuleCheckerImpl implements AccessControlRuleChecker { @Override public boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument) { return isAccessGranted(authentication, targetId, targetType, Arrays.asList(permission.split("\\|")), solrDocument); }  void postConstruct(); @Override boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument); @Override AccessControlRules getAccessControlRules(); @Override void setAccessControlRules(AccessControlRules accessControlRules); File getConfigurationFile(); void setConfigurationFile(File configurationFile); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); DataAccessControlConfig getDacConfig(); void setDacConfig(DataAccessControlConfig dacConfig); }
AccessControlRuleCheckerImpl implements AccessControlRuleChecker { @Override public boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument) { return isAccessGranted(authentication, targetId, targetType, Arrays.asList(permission.split("\\|")), solrDocument); }  void postConstruct(); @Override boolean isAccessGranted(Authentication authentication, Long targetId, String targetType, String permission, String solrDocument); @Override AccessControlRules getAccessControlRules(); @Override void setAccessControlRules(AccessControlRules accessControlRules); File getConfigurationFile(); void setConfigurationFile(File configurationFile); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); DataAccessControlConfig getDacConfig(); void setDacConfig(DataAccessControlConfig dacConfig);  }