AssertionType assertion = SAMLUtil.fromElement(tokenElement);
// check the assertion statements and look for role attributes.
AttributeStatementType attributeStatement = this.getAttributeStatement(assertion);
if (attributeStatement != null) {
RoleGroup rolesGroup = new SimpleRoleGroup(SAML20CommonTokenRoleAttributeProvider.JBOSS_ROLE_PRINCIPAL_NAME);
List<ASTChoiceType> attributeList = attributeStatement.getAttributes();
for (ASTChoiceType obj : attributeList) {
AttributeType attribute = obj.getAttribute();
if (attribute != null) {
// if this is a role attribute, get its values and add them to the role set.
if (tokenRoleAttributeName.equals(attribute.getName())) {
for (Object value : attribute.getAttributeValue()) {
rolesGroup.addRole(new SimpleRole((String) value));
}
}
}
}
result.setMappedObject(rolesGroup);