@Test public void filterViolationsNotEnforced() throws Exception { setupSecurityContext(false, entityMetadata(identityProviderIds), entityMetadata(serviceProviderIds)); List<PdpPolicyViolation> violations = pdpPolicyViolation(authenticatingAuthority, notOwnedIdp); Iterable<PdpPolicyViolation> filtered = this.subject.filterViolations(violations); assertEquals(2, stream(filtered.spliterator(), false).count()); }
public Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations) { FederatedUser user = federatedUser(); if (!user.isPolicyIdpAccessEnforcementRequired()) { return violations; } Set<String> idpsOfUserEntityIds = getEntityIds(user.getIdpEntities()); return stream(violations.spliterator(), false).filter(violation -> maySeeViolation(violation, idpsOfUserEntityIds)).collect(toList()); }
PolicyIdpAccessEnforcer implements JsonMapper { public Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations) { FederatedUser user = federatedUser(); if (!user.isPolicyIdpAccessEnforcementRequired()) { return violations; } Set<String> idpsOfUserEntityIds = getEntityIds(user.getIdpEntities()); return stream(violations.spliterator(), false).filter(violation -> maySeeViolation(violation, idpsOfUserEntityIds)).collect(toList()); } }
PolicyIdpAccessEnforcer implements JsonMapper { public Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations) { FederatedUser user = federatedUser(); if (!user.isPolicyIdpAccessEnforcementRequired()) { return violations; } Set<String> idpsOfUserEntityIds = getEntityIds(user.getIdpEntities()); return stream(violations.spliterator(), false).filter(violation -> maySeeViolation(violation, idpsOfUserEntityIds)).collect(toList()); }  }
PolicyIdpAccessEnforcer implements JsonMapper { public Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations) { FederatedUser user = federatedUser(); if (!user.isPolicyIdpAccessEnforcementRequired()) { return violations; } Set<String> idpsOfUserEntityIds = getEntityIds(user.getIdpEntities()); return stream(violations.spliterator(), false).filter(violation -> maySeeViolation(violation, idpsOfUserEntityIds)).collect(toList()); }  void actionAllowed(PdpPolicy pdpPolicy, PolicyAccess policyAccess, String serviceProviderId, List<String> identityProviderIds); boolean actionAllowedIndicator(PdpPolicy pdpPolicy, PolicyAccess policyAccess, String serviceProviderId, List<String> identityProviderIds); Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations); List<PdpPolicyDefinition> filterPdpPolicies(List<PdpPolicyDefinition> policies); List<EntityMetaData> filterIdentityProviders(List<EntityMetaData> identityProviders); static FederatedUser federatedUser(); String username(); String authenticatingAuthority(); String userDisplayName(); boolean isPolicyIdpAccessEnforcementRequired(); }
PolicyIdpAccessEnforcer implements JsonMapper { public Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations) { FederatedUser user = federatedUser(); if (!user.isPolicyIdpAccessEnforcementRequired()) { return violations; } Set<String> idpsOfUserEntityIds = getEntityIds(user.getIdpEntities()); return stream(violations.spliterator(), false).filter(violation -> maySeeViolation(violation, idpsOfUserEntityIds)).collect(toList()); }  void actionAllowed(PdpPolicy pdpPolicy, PolicyAccess policyAccess, String serviceProviderId, List<String> identityProviderIds); boolean actionAllowedIndicator(PdpPolicy pdpPolicy, PolicyAccess policyAccess, String serviceProviderId, List<String> identityProviderIds); Iterable<PdpPolicyViolation> filterViolations(Iterable<PdpPolicyViolation> violations); List<PdpPolicyDefinition> filterPdpPolicies(List<PdpPolicyDefinition> policies); List<EntityMetaData> filterIdentityProviders(List<EntityMetaData> identityProviders); static FederatedUser federatedUser(); String username(); String authenticatingAuthority(); String userDisplayName(); boolean isPolicyIdpAccessEnforcementRequired();  }