AttributeStatementType att = StatementUtil.createAttributeStatement(roles);
assertion.addStatement(att);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos));
writer.write(assertion);
SamlCredential cred = new SamlCredential(new String(baos.toByteArray()));
theSubject.getPublicCredentials().add(cred);
} catch (ProcessingException e) {
throw new RuntimeException(e);
}