uk.gov.ida.saml.security.validators.ValidatedAssertions Maven / Gradle / Ivy
package uk.gov.ida.saml.security.validators;
import org.opensaml.saml.saml2.core.Assertion;
import java.util.List;
import java.util.Optional;
public class ValidatedAssertions {
private List assertions;
public ValidatedAssertions(List assertions) {
this.assertions = assertions;
}
public List getAssertions() {
return assertions;
}
public Optional getMatchingDatasetAssertion() {
return assertions.stream()
.filter(this::isMatchingDatasetAssertion)
.findFirst();
}
public Optional getAuthnStatementAssertion() {
return assertions.stream()
.filter(assertion -> !this.isMatchingDatasetAssertion(assertion))
.findFirst();
}
private boolean isMatchingDatasetAssertion(Assertion assertion) {
return !assertion.getAttributeStatements().isEmpty() && assertion.getAuthnStatements().isEmpty();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy