@Test public void testGetFailedActions() { Role role = new Role().withArn("testRole"); EvaluationResult allowEvalResult = new EvaluationResult() .withEvalActionName("doAction") .withEvalResourceName("goodResource") .withEvalDecision(PolicyEvaluationDecisionType.Allowed); EvaluationResult denyEvalResult = new EvaluationResult() .withEvalActionName("doAction") .withEvalResourceName("badResource") .withEvalDecision(PolicyEvaluationDecisionType.ImplicitDeny); assertThat(getValidator().getFailedActions(role, Collections.emptyList())).isEqualTo(Collections.emptySortedSet()); List<EvaluationResult> allowEvalResults = Collections.singletonList(allowEvalResult); assertThat(getValidator().getFailedActions(role, allowEvalResults)).isEqualTo(Collections.emptySortedSet()); SortedSet<String> expectedFailedActions = new TreeSet<>(); expectedFailedActions.add(String.format("%s:%s:%s", role.getArn(), denyEvalResult.getEvalActionName(), denyEvalResult.getEvalResourceName())); List<EvaluationResult> denyEvalResults = Collections.singletonList(denyEvalResult); assertThat(getValidator().getFailedActions(role, denyEvalResults)) .isEqualTo(expectedFailedActions); List<EvaluationResult> multipleEvalResults = Arrays.asList(denyEvalResult, allowEvalResult, denyEvalResult, denyEvalResult, allowEvalResult); assertThat(getValidator().getFailedActions(role, multipleEvalResults)) .isEqualTo(expectedFailedActions); }
SortedSet<String> getFailedActions(Role role, List<EvaluationResult> evaluationResults) { return evaluationResults.stream() .filter(evaluationResult -> evaluationResult.getEvalDecision().toLowerCase().contains("deny")) .map(evaluationResult -> String.format("%s:%s:%s", role.getArn(), evaluationResult.getEvalActionName(), evaluationResult.getEvalResourceName())) .collect(Collectors.toCollection(TreeSet::new)); }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getFailedActions(Role role, List<EvaluationResult> evaluationResults) { return evaluationResults.stream() .filter(evaluationResult -> evaluationResult.getEvalDecision().toLowerCase().contains("deny")) .map(evaluationResult -> String.format("%s:%s:%s", role.getArn(), evaluationResult.getEvalActionName(), evaluationResult.getEvalResourceName())) .collect(Collectors.toCollection(TreeSet::new)); } }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getFailedActions(Role role, List<EvaluationResult> evaluationResults) { return evaluationResults.stream() .filter(evaluationResult -> evaluationResult.getEvalDecision().toLowerCase().contains("deny")) .map(evaluationResult -> String.format("%s:%s:%s", role.getArn(), evaluationResult.getEvalActionName(), evaluationResult.getEvalResourceName())) .collect(Collectors.toCollection(TreeSet::new)); }  }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getFailedActions(Role role, List<EvaluationResult> evaluationResults) { return evaluationResults.stream() .filter(evaluationResult -> evaluationResult.getEvalDecision().toLowerCase().contains("deny")) .map(evaluationResult -> String.format("%s:%s:%s", role.getArn(), evaluationResult.getEvalActionName(), evaluationResult.getEvalResourceName())) .collect(Collectors.toCollection(TreeSet::new)); }  void validate(AmazonIdentityManagement iam, CloudS3View cloudFileSystem,
            ValidationResultBuilder validationResultBuilder); }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getFailedActions(Role role, List<EvaluationResult> evaluationResults) { return evaluationResults.stream() .filter(evaluationResult -> evaluationResult.getEvalDecision().toLowerCase().contains("deny")) .map(evaluationResult -> String.format("%s:%s:%s", role.getArn(), evaluationResult.getEvalActionName(), evaluationResult.getEvalResourceName())) .collect(Collectors.toCollection(TreeSet::new)); }  void validate(AmazonIdentityManagement iam, CloudS3View cloudFileSystem,
            ValidationResultBuilder validationResultBuilder);  }