@Test public void testIsMatch_假如存在如上资源信息_当给定包含在资源信息时_那么返回true() { AuthenticationService authenticationService = new AuthenticationService(null); Resource resource = new Resource(); resource.setCode("user_manager:view"); Set<Resource> resources = Sets.newHashSet(resource); Assert.assertTrue(authenticationService.isMatch(new SecurityConfig("user_manager:view"), resources)); }
public boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources) { return userResources.stream().anyMatch(resource -> resource.getCode().equals(urlConfigAttribute.getAttribute())); }
AuthenticationService implements IAuthenticationService { public boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources) { return userResources.stream().anyMatch(resource -> resource.getCode().equals(urlConfigAttribute.getAttribute())); } }
AuthenticationService implements IAuthenticationService { public boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources) { return userResources.stream().anyMatch(resource -> resource.getCode().equals(urlConfigAttribute.getAttribute())); } @Autowired  AuthenticationService(Map<RequestMatcher, ConfigAttribute> resourceConfigAttributes); }
AuthenticationService implements IAuthenticationService { public boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources) { return userResources.stream().anyMatch(resource -> resource.getCode().equals(urlConfigAttribute.getAttribute())); } @Autowired  AuthenticationService(Map<RequestMatcher, ConfigAttribute> resourceConfigAttributes); @Override boolean decide(HttpServletRequest authRequest); boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources); ConfigAttribute findConfigAttributesByUrl(HttpServletRequest authRequest); }
AuthenticationService implements IAuthenticationService { public boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources) { return userResources.stream().anyMatch(resource -> resource.getCode().equals(urlConfigAttribute.getAttribute())); } @Autowired  AuthenticationService(Map<RequestMatcher, ConfigAttribute> resourceConfigAttributes); @Override boolean decide(HttpServletRequest authRequest); boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources); ConfigAttribute findConfigAttributesByUrl(HttpServletRequest authRequest); static final String NONEXISTENT_URL; }