<div dir="ltr"><div><div>Hi All,<br></div><div><br>org.opensaml.saml2.core.validator.AttributeStatementSchemaValidator.validateAttributes() doesn&#39;t considers EncryptedAttributes.
<br><br>As a result of this, getting ValidationException for an 
assertion with only EncryptedAttributes, with the following code snippet
 :
<br><br>ValidatorSuite schemaValidators = org.opensaml.Configuration.getValidatorSuite(&quot;saml2-core-schema-validator&quot;);
<br>try {
<br>schemaValidators.validate(assertionXMLObj);
<br>} catch (ValidationException e) {
<br>LOG.debug(&quot;Saml Validation error: &quot; + e.getMessage(), e);
<br>}
<br><br><br>Exception details :
<br><br>Caused by: org.opensaml.xml.validation.ValidationException: Must contain one or more attributes
<br>at 
org.opensaml.saml2.core.validator.AttributeStatementSchemaValidator.validateAttributes(AttributeStatementSchemaValidator.java:51)
<br>at org.opensaml.saml2.core.validator.AttributeStatementSchemaValidator.validate(AttributeStatementSchemaValidator.java:40)
<br>at org.opensaml.saml2.core.validator.AttributeStatementSchemaValidator.validate(AttributeStatementSchemaValidator.java:31)
<br>at org.opensaml.xml.validation.ValidatorSuite.performValidation(ValidatorSuite.java:169)
<br>at org.opensaml.xml.validation.ValidatorSuite.performValidation(ValidatorSuite.java:152)
<br>at org.opensaml.xml.validation.ValidatorSuite.validate(ValidatorSuite.java:83)
<br>at org.opensaml.xml.validation.ValidatorSuite.validate(ValidatorSuite.java:88)
<br><br><br><br>Resolution:
<br>In org.opensaml.saml2.core.validator.AttributeStatementSchemaValidator.java changed the validateAttributes():
<br><br> protected void validateAttributes(AttributeStatement attributeStatement) throws ValidationException {
<br>        if (attributeStatement.getAttributes() == null || attributeStatement.getAttributes().size() == 0) {
<br>         if(attributeStatement.getEncryptedAttributes()==null || attributeStatement.getEncryptedAttributes().size()==0)
<br>         throw new ValidationException(&quot;Must contain one or more attributes&quot;);
<br>        }
<br>    }
<br><br><br>Please comment on this.<br><br></div>Thanks and Regards,<br></div>Chandu.<br></div>