@Test @Parameters public void testOperationAuthorization(Permission operation, String user, List<IResource> resources, boolean expectedAuthorized) { assertThat(AUTHORIZER.isOperationAuthorizedForUser(operation, user, resources)).isEqualTo(expectedAuthorized); }
public boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain) { AuthenticatedUser authUser = AuthenticatedUserUtil.createFromString(user); IAuthorizer authorizer = getAuthorizer(); return resourceChain.stream() .map(resource -> authorizer.authorize(authUser, resource)) .anyMatch(permissions -> permissions.contains(operation)); }
AuditFilterAuthorizer { public boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain) { AuthenticatedUser authUser = AuthenticatedUserUtil.createFromString(user); IAuthorizer authorizer = getAuthorizer(); return resourceChain.stream() .map(resource -> authorizer.authorize(authUser, resource)) .anyMatch(permissions -> permissions.contains(operation)); } }
AuditFilterAuthorizer { public boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain) { AuthenticatedUser authUser = AuthenticatedUserUtil.createFromString(user); IAuthorizer authorizer = getAuthorizer(); return resourceChain.stream() .map(resource -> authorizer.authorize(authUser, resource)) .anyMatch(permissions -> permissions.contains(operation)); }  }
AuditFilterAuthorizer { public boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain) { AuthenticatedUser authUser = AuthenticatedUserUtil.createFromString(user); IAuthorizer authorizer = getAuthorizer(); return resourceChain.stream() .map(resource -> authorizer.authorize(authUser, resource)) .anyMatch(permissions -> permissions.contains(operation)); }  boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain); }
AuditFilterAuthorizer { public boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain) { AuthenticatedUser authUser = AuthenticatedUserUtil.createFromString(user); IAuthorizer authorizer = getAuthorizer(); return resourceChain.stream() .map(resource -> authorizer.authorize(authUser, resource)) .anyMatch(permissions -> permissions.contains(operation)); }  boolean isOperationAuthorizedForUser(Permission operation, String user, List<? extends IResource> resourceChain);  }