private static Log log = LogFactory.getLog(AttributeCallbackHandler.class);
protected Map<String, RequestedClaimData> requestedClaims = new HashMap<String, RequestedClaimData>();
protected Map<String, Claim> supportedClaims = new HashMap<String, Claim>();
public void handle(SAMLCallback callback) throws SAMLException {
SAMLAttributeCallback attrCallback = null;
RahasData data = null;
OMElement claimElem = null;
String userIdentifier = null;
IdentityAttributeService[] attributeCallbackServices = null;
try {
if (callback instanceof SAMLAttributeCallback) {
attrCallback = (SAMLAttributeCallback) callback;
data = attrCallback.getData();
claimElem = data.getClaimElem();
userIdentifier = data.getPrincipal().getName();
loadClaims(userIdentifier);
processClaimData(data, claimElem);
populateClaimValues(userIdentifier, attrCallback);
if (RahasConstants.TOK_TYPE_SAML_20.equals(data.getTokenType())) {
if (attrCallback.getSAML2Attributes() == null
|| attrCallback.getSAML2Attributes().length == 0) {
attrCallback.addAttributes(getSAML2Attribute("Name", "Colombo",
"https://rahas.apache.org/saml/attrns"));
}
} else {
if (attrCallback.getAttributes() == null
|| attrCallback.getAttributes().length == 0) {
SAMLAttribute attribute = new SAMLAttribute("Name",
"https://rahas.apache.org/saml/attrns", null, -1, Arrays
.asList(new String[]{"Colombo/Rahas"}));
attrCallback.addAttributes(attribute);
}
}
attributeCallbackServices = IdentityAttributeServiceStore.getAttributeServices();
for (int i = 0; i < attributeCallbackServices.length; i++) {