use of uk.gov.ida.saml.core.extensions.IPAddress in project verify-hub by alphagov.
the class IPAddressValidator method validate.
public void validate(Assertion assertion) {
for (AttributeStatement attributeStatement : assertion.getAttributeStatements()) {
for (Attribute attribute : attributeStatement.getAttributes()) {
if (attribute.getName().equals(IdaConstants.Attributes_1_1.IPAddress.NAME)) {
IPAddress ipAddressAttributeValue = (IPAddress) attribute.getAttributeValues().get(0);
String addressValue = ipAddressAttributeValue.getValue();
if (!Strings.isNullOrEmpty(addressValue)) {
return;
}
SamlValidationSpecificationFailure failure = SamlTransformationErrorFactory.emptyIPAddress(assertion.getID());
throw new SamlTransformationErrorException(failure.getErrorMessage(), failure.getLogLevel());
}
}
}
SamlValidationSpecificationFailure failure = SamlTransformationErrorFactory.missingIPAddress(assertion.getID());
throw new SamlTransformationErrorException(failure.getErrorMessage(), failure.getLogLevel());
}
Aggregations